Example #1
0
def create_ase_vdb(
    engine, server, jobs, vdb_group, vdb_name, environment_obj, container_obj
):
    """
    Create a Sybase ASE VDB
    """
    vdb_obj = find_database_by_name_and_group_name(
        engine, server, vdb_group.name, vdb_name
    )
    if vdb_obj == None:
        vdb_params = ASEProvisionParameters()
        vdb_params.container = ASEDBContainer()
        if arguments["--no_truncate_log"]:
            vdb_params.truncate_log_on_checkpoint = False
        else:
            vdb_params.truncate_log_on_checkpoint = True
        vdb_params.container.group = vdb_group.reference
        vdb_params.container.name = vdb_name
        vdb_params.source = ASEVirtualSource()
        vdb_params.source_config = ASESIConfig()
        vdb_params.source_config.database_name = arguments["--db"]
        vdb_params.source_config.instance = ASEInstanceConfig()
        vdb_params.source_config.instance.host = environment_obj.host

        vdb_repo = find_dbrepo_by_environment_ref_and_name(
            engine,
            server,
            "ASEInstance",
            environment_obj.reference,
            arguments["--envinst"],
        )

        vdb_params.source_config.repository = vdb_repo.reference
        vdb_params.timeflow_point_parameters = set_timeflow_point(
            engine, server, container_obj
        )

        vdb_params.timeflow_point_parameters.container = container_obj.reference
        print_info("Provisioning " + vdb_name)
        database.provision(server, vdb_params)

        # Add the job into the jobs dictionary so we can track its progress
        jobs[engine["hostname"]] = server.last_job
        # return the job object to the calling statement so that we can tell if
        # a job was created or not (will return None, if no job)
        return server.last_job
    else:
        print_info(engine["hostname"] + ": " + vdb_name + " already exists.")
        return vdb_obj.reference
Example #2
0
def create_mssql_vdb(engine, jobs, vdb_group, vdb_name, environment_obj, container_obj):
    """
    Create a MSSQL VDB
    engine:
    jobs:
    vdb_group:
    vdb_name,
    environment_obj:
    container_obj:

    """
    vdb_obj = find_database_by_name_and_group_name(
        engine, dx_session_obj.server_session, vdb_group.name, vdb_name
    )
    if vdb_obj == None:
        vdb_params = MSSqlProvisionParameters()
        vdb_params.container = MSSqlDatabaseContainer()
        vdb_params.container.group = vdb_group.reference
        vdb_params.container.name = vdb_name
        vdb_params.source = MSSqlVirtualSource()
        vdb_params.source.allow_auto_vdb_restart_on_host_reboot = False
        vdb_params.source_config = MSSqlSIConfig()
        vdb_params.source_config.database_name = arguments["--db"]

        vdb_params.source_config.repository = find_dbrepo(
            dx_session_obj.server_session,
            "MSSqlInstance",
            environment_obj.reference,
            arguments["--envinst"],
        ).reference

        vdb_params.timeflow_point_parameters = set_timeflow_point(
            engine, dx_session_obj.server_session, container_obj
        )
        if not vdb_params.timeflow_point_parameters:
            return
        vdb_params.timeflow_point_parameters.container = container_obj.reference
        print_info(engine["hostname"] + ":Provisioning " + vdb_name)
        database.provision(dx_session_obj.server_session, vdb_params)
        # Add the job into the jobs dictionary so we can track its progress
        jobs[engine["hostname"]] = dx_session_obj.server_session.last_job
        # return the job object to the calling statement so that we can tell if
        # a job was created or not (will return None, if no job)
        return dx_session_obj.server_session.last_job
    else:
        print_info(engine["hostname"] + ": " + vdb_name + " already exists.")
        return vdb_obj.reference
def create_mssql_vdb(engine, jobs, vdb_group, vdb_name, 
                     environment_obj, container_obj):
    '''
    Create a MSSQL VDB
    engine:
    jobs:
    vdb_group:
    vdb_name,
    environment_obj:
    container_obj:
    
    '''
    vdb_obj = find_database_by_name_and_group_name(engine, dx_session_obj.server_session,
                                                   vdb_group.name, vdb_name)
    if vdb_obj == None:
        vdb_params = MSSqlProvisionParameters()
        vdb_params.container = MSSqlDatabaseContainer()
        vdb_params.container.group = vdb_group.reference
        vdb_params.container.name = vdb_name
        vdb_params.source = MSSqlVirtualSource()
        vdb_params.source.allow_auto_vdb_restart_on_host_reboot = False
        vdb_params.source_config = MSSqlSIConfig()
        vdb_params.source_config.database_name = arguments['--db']

        vdb_params.source_config.repository = find_dbrepo(
            dx_session_obj.server_session, 'MSSqlInstance', environment_obj.reference,
            arguments['--envinst']).reference

        vdb_params.timeflow_point_parameters = set_timeflow_point(engine, 
                                                                  dx_session_obj.server_session, 
                                                                  container_obj)
        if not vdb_params.timeflow_point_parameters:
            return
        vdb_params.timeflow_point_parameters.container = \
                                             container_obj.reference
        print_info(engine["hostname"] + ":Provisioning " + vdb_name)
        database.provision(dx_session_obj.server_session, vdb_params)
        #Add the job into the jobs dictionary so we can track its progress
        jobs[engine["hostname"]] = dx_session_obj.server_session.last_job
        #return the job object to the calling statement so that we can tell if 
        # a job was created or not (will return None, if no job)
        return dx_session_obj.server_session.last_job
    else:
        print_info(engine["hostname"] + ": " + vdb_name + " already exists.")
        return vdb_obj.reference
def create_ase_vdb(engine, server, jobs, vdb_group, vdb_name, environment_obj, 
                   container_obj):
    '''
    Create a Sybase ASE VDB
    '''
    vdb_obj = find_database_by_name_and_group_name(engine, server, 
                                                   vdb_group.name, vdb_name)
    if vdb_obj == None:
        vdb_params = ASEProvisionParameters()
        vdb_params.container = ASEDBContainer()
        if arguments['--no_truncate_log']:
            vdb_params.truncate_log_on_checkpoint = False
        else:
            vdb_params.truncate_log_on_checkpoint = True
        vdb_params.container.group = vdb_group.reference
        vdb_params.container.name = vdb_name
        vdb_params.source = ASEVirtualSource()
        vdb_params.source_config = ASESIConfig()
        vdb_params.source_config.database_name = arguments['--db']
        vdb_params.source_config.instance = ASEInstanceConfig()
        vdb_params.source_config.instance.host = environment_obj.host

        vdb_repo = find_dbrepo_by_environment_ref_and_name(engine, server, 
                                                     "ASEInstance", 
                                                     environment_obj.reference,
                                                     arguments['--envinst'])

        vdb_params.source_config.repository = vdb_repo.reference
        vdb_params.timeflow_point_parameters = set_timeflow_point(engine, 
                                                                  server, 
                                                                  container_obj)

        vdb_params.timeflow_point_parameters.container = container_obj.reference
        print_info("Provisioning " + vdb_name)
        database.provision(server, vdb_params)

        #Add the job into the jobs dictionary so we can track its progress
        jobs[engine["hostname"]] = server.last_job
        #return the job object to the calling statement so that we can tell if 
        # a job was created or not (will return None, if no job)
        return server.last_job
    else:
        print_info(engine["hostname"] + ": " + vdb_name + " already exists.")
        return vdb_obj.reference
Example #5
0
def create_oracle_si_vdb(
    engine,
    jobs,
    vdb_name,
    vdb_group_obj,
    environment_obj,
    container_obj,
    pre_refresh=None,
    post_refresh=None,
    pre_rollback=None,
    post_rollback=None,
    configure_clone=None,
):

    """
    Create an Oracle SI VDB
    """

    vdb_obj = None

    try:
        vdb_obj = find_obj_by_name(dx_session_obj.server_session, database, vdb_name)
    except DlpxException:
        pass

    if vdb_obj == None:
        vdb_params = OracleProvisionParameters()
        vdb_params.open_resetlogs = True

        if arguments["--noopen"]:
            vdb_params.open_resetlogs = False

        vdb_params.container = OracleDatabaseContainer()
        vdb_params.container.group = vdb_group_obj.reference
        vdb_params.container.name = vdb_name
        vdb_params.source = OracleVirtualSource()
        vdb_params.source.allow_auto_vdb_restart_on_host_reboot = False

        if arguments["--instname"]:
            inst_name = arguments["--instname"]
        elif arguments["--instname"] == None:
            inst_name = vdb_name

        if arguments["--uniqname"]:
            unique_name = arguments["--uniqname"]
        elif arguments["--uniqname"] == None:
            unique_name = vdb_name

        if arguments["--db"]:
            db = arguments["--db"]
        elif arguments["--db"] == None:
            db = vdb_name

        vdb_params.source.mount_base = arguments["--mntpoint"]

        if arguments["--mapfile"]:
            vdb_params.source.file_mapping_rules = arguments["--mapfile"]

        if arguments["--template"]:
            template_obj = find_obj_by_name(
                dx_session_obj.server_session,
                database.template,
                arguments["--template"],
            )

            vdb_params.source.config_template = template_obj.reference

        vdb_params.source_config = OracleSIConfig()
        vdb_params.source.operations = VirtualSourceOperations()

        if pre_refresh:
            vdb_params.source.operations.pre_refresh = [
                {"type": "RunCommandOnSourceOperation", "command": pre_refresh}
            ]

        if post_refresh:
            vdb_params.source.operations.post_refresh = [
                {"type": "RunCommandOnSourceOperation", "command": post_refresh}
            ]

        if pre_rollback:
            vdb_params.source.operations.pre_rollback = [
                {"type": "RunCommandOnSourceOperation", "command": pre_rollback}
            ]

        if post_rollback:
            vdb_params.source.operations.post_rollback = [
                {"type": "RunCommandOnSourceOperation", "command": post_rollback}
            ]

        if configure_clone:
            vdb_params.source.operations.configure_clone = [
                {"type": "RunCommandOnSourceOperation", "command": configure_clone}
            ]

        vdb_repo = find_dbrepo_by_environment_ref_and_install_path(
            engine,
            dx_session_obj.server_session,
            "OracleInstall",
            environment_obj.reference,
            arguments["--envinst"],
        )

        vdb_params.source_config.database_name = db
        vdb_params.source_config.unique_name = unique_name
        vdb_params.source_config.instance = OracleInstance()
        vdb_params.source_config.instance.instance_name = inst_name
        vdb_params.source_config.instance.instance_number = 1
        vdb_params.source_config.repository = vdb_repo.reference

        dx_timeflow_obj = DxTimeflow(dx_session_obj.server_session)
        vdb_params.timeflow_point_parameters = dx_timeflow_obj.set_timeflow_point(
            container_obj, arguments["--timestamp_type"], arguments["--timestamp"]
        )

        print(vdb_params, "\n\n\n")
        print_info(engine["hostname"] + ": Provisioning " + vdb_name)
        database.provision(dx_session_obj.server_session, vdb_params)
        # Add the job into the jobs dictionary so we can track its progress

        jobs[engine["hostname"]] = dx_session_obj.server_session.last_job
        # return the job object to the calling statement so that we can tell if
        # a job was created or not (will return None, if no job)

        return dx_session_obj.server_session.last_job

    else:
        raise DlpxException(
            "\nERROR: %s: %s alread exists\n" % (engine["hostname"], vdb_name)
        )
Example #6
0
def create_vfiles_vdb(
    engine,
    jobs,
    vfiles_group,
    vfiles_name,
    environment_obj,
    container_obj,
    pre_refresh=None,
    post_refresh=None,
    pre_rollback=None,
    post_rollback=None,
    configure_clone=None,
):
    """
    Create a Vfiles VDB
    """

    vfiles_obj = None

    try:
        vfiles_obj = find_obj_by_name(
            dx_session_obj.server_session, database, vfiles_name
        )
    except DlpxException:
        pass

    if vfiles_obj is None:
        vfiles_repo = find_repo_by_environment_ref(
            engine, "Unstructured Files", environment_obj.reference
        )

        vfiles_params = AppDataProvisionParameters()
        vfiles_params.source = AppDataVirtualSource()
        vfiles_params.source_config = AppDataDirectSourceConfig()

        vdb_restart_reobj = re.compile("true", re.IGNORECASE)

        if vdb_restart_reobj.search(str(arguments["--vdb_restart"])):
            vfiles_params.source.allow_auto_vdb_restart_on_host_reboot = True

        elif vdb_restart_reobj.search(str(arguments["--vdb_restart"])) is None:
            vfiles_params.source.allow_auto_vdb_restart_on_host_reboot = False

        vfiles_params.container = {
            "type": "AppDataContainer",
            "group": vfiles_group.reference,
            "name": vfiles_name,
        }

        vfiles_params.source_config.name = arguments["--target"]
        vfiles_params.source_config.path = arguments["--vfiles_path"]
        vfiles_params.source_config.environment_user = environment_obj.primary_user
        vfiles_params.source_config.repository = vfiles_repo.reference

        vfiles_params.source.parameters = {}
        vfiles_params.source.name = vfiles_name
        vfiles_params.source.name = vfiles_name
        vfiles_params.source.operations = VirtualSourceOperations()

        if pre_refresh:
            vfiles_params.source.operations.pre_refresh = [
                {"type": "RunCommandOnSourceOperation", "command": pre_refresh}
            ]

        if post_refresh:
            vfiles_params.source.operations.post_refresh = [
                {"type": "RunCommandOnSourceOperation", "command": post_refresh}
            ]

        if pre_rollback:
            vfiles_params.source.operations.pre_rollback = [
                {"type": "RunCommandOnSourceOperation", "command": pre_rollback}
            ]

        if post_rollback:
            vfiles_params.source.operations.post_rollback = [
                {"type": "RunCommandOnSourceOperation", "command": post_rollback}
            ]

        if configure_clone:
            vfiles_params.source.operations.configure_clone = [
                {"type": "RunCommandOnSourceOperation", "command": configure_clone}
            ]

        if arguments["--timestamp_type"] is None:
            vfiles_params.timeflow_point_parameters = {
                "type": "TimeflowPointSemantic",
                "container": container_obj.reference,
                "location": "LATEST_POINT",
            }

        elif arguments["--timestamp_type"].upper() == "SNAPSHOT":

            try:
                dx_timeflow_obj = DxTimeflow(dx_session_obj.server_session)
                dx_snap_params = dx_timeflow_obj.set_timeflow_point(
                    container_obj,
                    arguments["--timestamp_type"],
                    arguments["--timestamp"],
                    arguments["--timeflow"],
                )

            except RequestError as e:
                raise DlpxException("Could not set the timeflow point:\n%s" % (e))

            if dx_snap_params.type == "TimeflowPointSemantic":
                vfiles_params.timeflow_point_parameters = {
                    "type": dx_snap_params.type,
                    "container": dx_snap_params.container,
                    "location": dx_snap_params.location,
                }

            elif dx_snap_params.type == "TimeflowPointTimestamp":
                vfiles_params.timeflow_point_parameters = {
                    "type": dx_snap_params.type,
                    "timeflow": dx_snap_params.timeflow,
                    "timestamp": dx_snap_params.timestamp,
                }

        print_info("%s: Provisioning %s\n" % (engine["hostname"], vfiles_name))

        try:
            database.provision(dx_session_obj.server_session, vfiles_params)

        except (JobError, RequestError, HttpError) as e:
            raise DlpxException(
                "\nERROR: Could not provision the database:" "\n%s" % (e)
            )

        # Add the job into the jobs dictionary so we can track its progress
        jobs[engine["hostname"]] = dx_session_obj.server_session.last_job

        # return the job object to the calling statement so that we can tell if
        # a job was created or not (will return None, if no job)
        return dx_session_obj.server_session.last_job
    else:
        print_info(
            "\nERROR %s: %s already exists. \n" % (engine["hostname"], vfiles_name)
        )
        return vfiles_obj.reference
Example #7
0
def create_vfiles_vdb(engine,
                      jobs,
                      vfiles_group,
                      vfiles_name,
                      environment_obj,
                      container_obj,
                      pre_refresh=None,
                      post_refresh=None,
                      pre_rollback=None,
                      post_rollback=None,
                      configure_clone=None):
    '''
    Create a Vfiles VDB
    '''

    vfiles_obj = None

    try:
        vfiles_obj = find_obj_by_name(dx_session_obj.server_session, database,
                                      vfiles_name)
    except DlpxException:
        pass

    if vfiles_obj is None:
        vfiles_repo = find_repo_by_environment_ref(engine,
                                                   'Unstructured Files',
                                                   environment_obj.reference)

        vfiles_params = AppDataProvisionParameters()
        vfiles_params.source = AppDataVirtualSource()
        vfiles_params.source_config = AppDataDirectSourceConfig()

        vdb_restart_reobj = re.compile('true', re.IGNORECASE)

        if vdb_restart_reobj.search(str(arguments['--vdb_restart'])):
            vfiles_params.source.allow_auto_vdb_restart_on_host_reboot = True

        elif vdb_restart_reobj.search(str(arguments['--vdb_restart'])) is None:
            vfiles_params.source.allow_auto_vdb_restart_on_host_reboot = False

        vfiles_params.container = {
            'type': 'AppDataContainer',
            'group': vfiles_group.reference,
            'name': vfiles_name
        }

        vfiles_params.source_config.name = arguments['--target']
        vfiles_params.source_config.path = arguments['--vfiles_path']
        vfiles_params.source_config.environment_user = \
                                    environment_obj.primary_user
        vfiles_params.source_config.repository = vfiles_repo.reference

        vfiles_params.source.parameters = {}
        vfiles_params.source.name = vfiles_name
        vfiles_params.source.name = vfiles_name
        vfiles_params.source.operations = VirtualSourceOperations()

        if pre_refresh:
            vfiles_params.source.operations.pre_refresh = [{
                'type':
                'RunCommandOnSourceOperation',
                'command':
                pre_refresh
            }]

        if post_refresh:
            vfiles_params.source.operations.post_refresh = [{
                'type':
                'RunCommandOnSourceOperation',
                'command':
                post_refresh
            }]

        if pre_rollback:
            vfiles_params.source.operations.pre_rollback = [{
                'type':
                'RunCommandOnSourceOperation',
                'command':
                pre_rollback
            }]

        if post_rollback:
            vfiles_params.source.operations.post_rollback = [{
                'type':
                'RunCommandOnSourceOperation',
                'command':
                post_rollback
            }]

        if configure_clone:
            vfiles_params.source.operations.configure_clone = [{
                'type':
                'RunCommandOnSourceOperation',
                'command':
                configure_clone
            }]

        if arguments['--timestamp_type'] is None:
            vfiles_params.timeflow_point_parameters = {
                'type': 'TimeflowPointSemantic',
                'container': container_obj.reference,
                'location': 'LATEST_POINT'
            }

        elif arguments['--timestamp_type'].upper() == 'SNAPSHOT':

            try:
                dx_timeflow_obj = DxTimeflow(dx_session_obj.server_session)
                dx_snap_params = dx_timeflow_obj.set_timeflow_point(
                    container_obj, arguments['--timestamp_type'],
                    arguments['--timestamp'], arguments['--timeflow'])

            except RequestError as e:
                raise DlpxException('Could not set the timeflow point:\n%s' %
                                    (e))

            if dx_snap_params.type == 'TimeflowPointSemantic':
                vfiles_params.timeflow_point_parameters = {
                    'type': dx_snap_params.type,
                    'container': dx_snap_params.container,
                    'location': dx_snap_params.location
                }

            elif dx_snap_params.type == 'TimeflowPointTimestamp':
                vfiles_params.timeflow_point_parameters = {
                    'type': dx_snap_params.type,
                    'timeflow': dx_snap_params.timeflow,
                    'timestamp': dx_snap_params.timestamp
                }

        print_info('%s: Provisioning %s\n' % (engine["hostname"], vfiles_name))

        try:
            database.provision(dx_session_obj.server_session, vfiles_params)

        except (JobError, RequestError, HttpError) as e:
            raise DlpxException('\nERROR: Could not provision the database:'
                                '\n%s' % (e))

        #Add the job into the jobs dictionary so we can track its progress
        jobs[engine['hostname']] = dx_session_obj.server_session.last_job

        #return the job object to the calling statement so that we can tell if
        # a job was created or not (will return None, if no job)
        return dx_session_obj.server_session.last_job
    else:
        print_info('\nERROR %s: %s already exists. \n' %
                   (engine['hostname'], vfiles_name))
        return vfiles_obj.reference
def create_oracle_si_vdb(engine, jobs, vdb_name, vdb_group_obj,
                         environment_obj, container_obj, pre_refresh=None,
                         post_refresh=None, pre_rollback=None,
                         post_rollback=None, configure_clone=None):

    '''
    Create an Oracle SI VDB
    '''

    vdb_obj = None

    try:
        vdb_obj = find_obj_by_name(dx_session_obj.server_session, database, 
                                   vdb_name)
    except DlpxException:
        pass

    if vdb_obj == None:
        vdb_params = OracleProvisionParameters()
        vdb_params.open_resetlogs = True

        if arguments['--noopen']:
            vdb_params.open_resetlogs = False

        vdb_params.container = OracleDatabaseContainer()
        vdb_params.container.group = vdb_group_obj.reference
        vdb_params.container.name = vdb_name
        vdb_params.source = OracleVirtualSource()
        vdb_params.source.allow_auto_vdb_restart_on_host_reboot = False

        if arguments['--instname']:
            inst_name = arguments['--instname']
        elif arguments['--instname'] == None:
            inst_name = vdb_name

        if arguments['--uniqname']:
            unique_name = arguments['--uniqname']
        elif arguments['--uniqname'] == None:
            unique_name = vdb_name

        if arguments['--db']:
            db = arguments['--db']
        elif arguments['--db'] == None:
            db = vdb_name

        vdb_params.source.mount_base = arguments['--mntpoint']

        if arguments['--mapfile']:
            vdb_params.source.file_mapping_rules = arguments['--mapfile']

        if arguments['--template']:
                template_obj = find_obj_by_name(dx_session_obj.server_session,
                                                database.template, 
                                                arguments['--template'])

                vdb_params.source.config_template = template_obj.reference

        vdb_params.source_config = OracleSIConfig()
        vdb_params.source.operations = VirtualSourceOperations()

        if pre_refresh:
            vdb_params.source.operations.pre_refresh = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': pre_refresh }]

        if post_refresh:
            vdb_params.source.operations.post_refresh = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': post_refresh }]

        if pre_rollback:
            vdb_params.source.operations.pre_rollback = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': pre_rollback }]

        if post_rollback:
            vdb_params.source.operations.post_rollback = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': post_rollback }]

        if configure_clone:
            vdb_params.source.operations.configure_clone = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': configure_clone }]

        vdb_repo = find_dbrepo_by_environment_ref_and_install_path(engine,
                                                dx_session_obj.server_session,
                                                'OracleInstall',
                                                environment_obj.reference,
                                                arguments['--envinst'])

        vdb_params.source_config.database_name = db
        vdb_params.source_config.unique_name = unique_name
        vdb_params.source_config.instance = OracleInstance()
        vdb_params.source_config.instance.instance_name = inst_name
        vdb_params.source_config.instance.instance_number = 1
        vdb_params.source_config.repository = vdb_repo.reference

        dx_timeflow_obj = DxTimeflow(dx_session_obj.server_session)
        vdb_params.timeflow_point_parameters = \
               dx_timeflow_obj.set_timeflow_point(container_obj,
                                                  arguments['--timestamp_type'],
                                                  arguments['--timestamp'])

        print vdb_params, '\n\n\n'
        print_info(engine["hostname"] + ": Provisioning " + vdb_name)
        database.provision(dx_session_obj.server_session, vdb_params)
        #Add the job into the jobs dictionary so we can track its progress

        jobs[engine['hostname']] = dx_session_obj.server_session.last_job
        #return the job object to the calling statement so that we can tell if 
        # a job was created or not (will return None, if no job)

        return dx_session_obj.server_session.last_job

    else:
        raise DlpxException('\nERROR: %s: %s alread exists\n' %
                            (engine['hostname'], vdb_name))
def create_vfiles_vdb(engine, jobs, vfiles_group, vfiles_name, 
                      environment_obj, container_obj, pre_refresh=None,
                      post_refresh=None, pre_rollback=None, 
                      post_rollback=None, configure_clone=None):
    '''
    Create a Vfiles VDB
    '''

    vfiles_obj = None

    try:
        vfiles_obj = find_obj_by_name(dx_session_obj.server_session,
                                      database, vfiles_name)
    except DlpxException:
        pass

    if vfiles_obj is None:
        vfiles_repo = find_repo_by_environment_ref(engine,
                                                   'Unstructured Files',
                                                   environment_obj.reference)

        vfiles_params = AppDataProvisionParameters()
        vfiles_params.source = AppDataVirtualSource()
        vfiles_params.source_config = AppDataDirectSourceConfig()

        vdb_restart_reobj = re.compile('true', re.IGNORECASE)

        if vdb_restart_reobj.search(str(arguments['--vdb_restart'])):
            vfiles_params.source.allow_auto_vdb_restart_on_host_reboot = True

        elif vdb_restart_reobj.search(str(arguments['--vdb_restart'])) is None:
            vfiles_params.source.allow_auto_vdb_restart_on_host_reboot = False

        vfiles_params.container = { 'type': 'AppDataContainer', 
                                    'group': vfiles_group.reference,
                                    'name': vfiles_name }

        vfiles_params.source_config.name = arguments['--target']
        vfiles_params.source_config.path = arguments['--vfiles_path']
        vfiles_params.source_config.environment_user = \
                                    environment_obj.primary_user
        vfiles_params.source_config.repository = vfiles_repo.reference

        
        vfiles_params.source.parameters = {}
        vfiles_params.source.name = vfiles_name
        vfiles_params.source.name = vfiles_name
        vfiles_params.source.operations = VirtualSourceOperations()

        if pre_refresh:
            vfiles_params.source.operations.pre_refresh = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': pre_refresh }]

        if post_refresh:
            vfiles_params.source.operations.post_refresh = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': post_refresh }]

        if pre_rollback:
            vfiles_params.source.operations.pre_rollback = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': pre_rollback }]

        if post_rollback:
            vfiles_params.source.operations.post_rollback = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': post_rollback }]

        if configure_clone:
            vfiles_params.source.operations.configure_clone = [{ 'type':
                                                 'RunCommandOnSourceOperation',
                                                 'command': configure_clone }]
 
        if arguments['--timestamp_type'] is None:
            vfiles_params.timeflow_point_parameters = { 
                                         'type': 'TimeflowPointSemantic',
                                         'container': container_obj.reference,
                                         'location': 'LATEST_POINT'}

        elif arguments['--timestamp_type'].upper() == 'SNAPSHOT':

            try:
                dx_timeflow_obj = DxTimeflow(dx_session_obj.server_session)
                dx_snap_params = dx_timeflow_obj.set_timeflow_point(
                                                container_obj,
                                                arguments['--timestamp_type'],
                                                arguments['--timestamp'],
                                                arguments['--timeflow'])

            except RequestError as e:
                raise DlpxException('Could not set the timeflow point:\n%s' 
                                    % (e))

            if dx_snap_params.type == 'TimeflowPointSemantic':
                vfiles_params.timeflow_point_parameters = {'type':
                                             dx_snap_params.type,
                                             'container':
                                             dx_snap_params.container,
                                             'location': 
                                             dx_snap_params.location}

            elif dx_snap_params.type == 'TimeflowPointTimestamp':
                vfiles_params.timeflow_point_parameters = {'type':
                                             dx_snap_params.type,
                                             'timeflow':
                                             dx_snap_params.timeflow,
                                             'timestamp': 
                                             dx_snap_params.timestamp}

        print_info('%s: Provisioning %s\n' % (engine["hostname"],
                                              vfiles_name))

        try:
            database.provision(dx_session_obj.server_session, vfiles_params)

        except (JobError, RequestError, HttpError) as e:
            raise DlpxException('\nERROR: Could not provision the database:' 
                                '\n%s' % (e))


        #Add the job into the jobs dictionary so we can track its progress
        jobs[engine['hostname']] = dx_session_obj.server_session.last_job

        #return the job object to the calling statement so that we can tell if 
        # a job was created or not (will return None, if no job)
        return dx_session_obj.server_session.last_job
    else:
        print_info('\nERROR %s: %s already exists. \n' % (engine['hostname'],
                                                          vfiles_name))
        return vfiles_obj.reference