Ejemplo n.º 1
0
def main(argv):
    """Creates a project in the Informatica Model Repository.
    Usage: createProject.py [-h] -p PROJECT_NAME
    """
    thisproc = "MAIN"
    mainProc = 'createProject'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.")

    project_name = args.project_name
    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    project = manageFolder.ManageFolder(Tool="CreateProject",
                                        Domain=infaSettings.sourceDomain,
                                        ServiceName=infaSettings.sourceModelRepository,
                                        ProjectName=project_name,
                                        OnError=errorcodes.INFACMD_CREATE_PROJECT_FAILED
                                        )

    result = manageFolder.ManageFolder.manage(project)

    supporting.log(logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc)
                   + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 2
0
def main(argv):
    """Remove a user group from the Informatica Domain
    Usage: deleteGroup.py [-h] -g GROUP_NAME
    """
    thisproc = "MAIN"
    mainProc = 'deleteGroup'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    group_name = args.group_name

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    group = manageSecurity.ManageSecurity(
        Tool="DeleteGroup",
        Domain=infaSettings.sourceDomain,
        GroupName=group_name,
        OnError=errorcodes.INFACMD_DELETE_GROUP_FAILED)
    result = manageSecurity.ManageSecurity.manage(group)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 3
0
def main(argv):
    """Deploys an Informatica Platform artifact
    Usage: deployInformaticaPlatformArtifact.py [-h]
    The module uses environment variables to steer the import on the target environment
    """
    thisproc = "MAIN"
    mainProc = 'deployInformaticaPlatformArtifact'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + logDir + "<.")

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    # Check requirements for artifact generation
    result = infaArtifactChecks.infadeploychecks()
    if result.rc != 0:
        supporting.log(logger, logging.ERROR, thisproc,
                       'INFA Checks failed with >' + result.message + "<.")
        supporting.exitscript(resultlogger, result)

    #    result = informatica.import_infadeveloper(infaConstants.DEPLOYARTIFACT, infaSettings.infadeploylist)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 4
0
def main(argv):
    """Generate an Informatica Platform artifact based on environment variables
    """
    thisproc = "MAIN"
    mainProc = 'CreateInformaticaPlatformArtifact'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalsettings.logDir + "<.")

    settings.getinfaenvvars()
    settings.outinfaenvvars()

    # Check requirements for artifact generation
    result = infachecks.infaartifactchecks()
    if result.rc != 0:
        supporting.log(logger, logging.ERROR, thisproc,
                       'INFA Checks failed with >' + result.message + "<.")
        supporting.exitscript(resultlogger, result)

    result = artifact.processList(infaConstants.CREATEARTIFACT,
                                  settings.infadeploylist)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    #    supporting.writeresult(resultlogger, result)
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 5
0
def main(argv):
    """Runs a Mapping.
    usage: runMapping.py [-h] -a APPLICATION_NAME -m MAPPING_NAME
                     [-p {Source,Target,Full}] [-o {0,1,2,3,4,5}]
                     [-l {0,1,2,3,4,5}] [-x AS_IS_OPTIONS]
    """
    thisproc = "MAIN"
    mainProc = 'runMapping'

    args = parse_the_arguments(argv)

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.")

    application_name = args.application_name
    mapping_name = args.mapping_name

    pushdown_type = args.pushdown_type
    optimization_level = args.optimization_level
    as_is_options = args.as_is_options

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()
    supporting.logentireenv()

    """with AsIsOptions, you can speficy e.g. a parameter set
        Example:
        runMapping myApp myMapping Source 3 "-ParameterSet myParameterSet -OperatingSystemProfile myOSProfile"
        It is important to supply the AsIsOptions as one single string
    """
    mapping = jobManagement.JobExecution(Tool="RunMapping",
                                         Domain=infaSettings.sourceDomain,
                                         ServiceName=infaSettings.sourceDIS,
                                         Application=application_name,
                                         Mapping=mapping_name,
                                         PushdownType=pushdown_type,
                                         OptimizationLevel=optimization_level,
                                         Wait="true",
                                         OnError=errorcodes.INFACMD_MAPPING_FAILED,
                                         AsIsOptions=as_is_options
                                         )
    result = jobManagement.JobExecution.manage(mapping)

    supporting.log(logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc)
                   + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 6
0
def main(argv):
    """Create a user.
    If a password is not provided, one will be generated
    usage: createUser.py [-h] -u USERNAME [-p PASSWORD] -f FULLNAME
                     [-d DESCRIPTION] [-e EMAIL] [-n PHONENUMBER]
    """
    thisproc = "MAIN"
    mainProc = 'createUser'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args, generated_password = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    user_name = args.username
    user_password = args.password
    user_fullname = args.fullname
    user_description = args.description
    user_email = args.email
    user_phone = args.phonenumber

    if generated_password:
        print(args.password)

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    user = manageSecurity.ManageSecurity(
        Tool="CreateUser",
        Domain=infaSettings.sourceDomain,
        NewUserName=user_name,
        NewUserPassword=user_password,
        NewUserFullName=user_fullname,
        NewUserDescription=user_description,
        NewUserEmailAddress=user_email,
        NewUserPhoneNumber=user_phone,
        OnError=errorcodes.INFACMD_CREATE_USER_FAILED)
    result = manageSecurity.ManageSecurity.manage(user)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 7
0
def main(argv):
    """Exports the connection definitions from the Informatica Domain.
    Usage: exportConnections.py [-h] [-o OUTPUT_FILE] [-e EXPORT_CONTROL_FILE]
    If no output file is provided, the default is set as per infaConstants.DEFAULT_EXPORT_CONNECTIONSFILE
    For information about the export control file, check the Informatica documentation.
    """
    thisproc = "MAIN"
    mainProc = 'exportConnections'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.")

    output_file = args.output_file
    export_control_file = args.export_control_file

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    if export_control_file != "":
        connection = manageConnection.ManageConnection(Tool="ExportConnections",
                                                       Domain=infaSettings.sourceDomain,
                                                       ExportControlfile=export_control_file,
                                                       ExportFile=output_file,
                                                       RetainPassword='******',
                                                       Force='true',
                                                       OnError=errorcodes.INFACMD_EXPORT_CONN_FAILED
                                                       )
    else:
        connection = manageConnection.ManageConnection(Tool="ExportConnections",
                                                       Domain=infaSettings.sourceDomain,
                                                       ExportFile=output_file,
                                                       RetainPassword='******',
                                                       Force='true',
                                                       OnError=errorcodes.INFACMD_EXPORT_CONN_FAILED
                                                       )

    result = connection.manage()

    supporting.log(logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc)
                   + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 8
0
def main(argv):
    """List the connections as available in the Informatica domain.
    Usage: listConnections.py [-h] [-o OUTPUT_FILE]
    If no output file is provided, the default will be taken from infaConstants.DEFAULT_CONNECTIONSFILE
    """
    thisproc = "MAIN"
    mainProc = 'listConnections'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    output_file = args.output_file

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    connection = manageConnection.ManageConnection(
        Tool="ListConnections",
        Domain=infaSettings.sourceDomain,
        OnError=errorcodes.INFACMD_LIST_CONN_FAILED,
        OutputFile=output_file)
    result = manageConnection.ManageConnection.manage(connection)
    if result.rc == errorcodes.OK.rc:
        result = connection.parseConnectionListOutput(output_file)
        if result.rc == errorcodes.OK.rc:
            result = connection.writeConnectionList(output_file)
        else:
            supporting.log(
                logger, logging.DEBUG, thisproc,
                'parseConnectionListOutput completed with return code >' +
                str(result.rc) + '< and result code >' + result.code + "<.")
    else:
        with open(output_file, 'r') as f:
            for line in f:
                result.message += line.rstrip()

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 9
0
def main(argv):
    """Runs a Workflow.
    usage: runWorkflow.py [-h] -a APPLICATION_NAME -w WORKFLOW_NAME
                      [-c {True,False}] [-l {0,1,2,3,4,5}] [-x AS_IS_OPTIONS]
    with AsIsOptions, you can speficy e.g. a parameter set
        Example:
        runMapping myApp myMapping Source 3 "-ParameterSet myParameterSet -OperatingSystemProfile myOSProfile"
        It is important to supply the AsIsOptions as one single string
    """
    thisproc = "MAIN"
    mainProc = 'runWorkflow'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    application_name = args.application_name
    workflow_name = args.workflow_name
    wait = args.wait
    as_is_options = args.as_is_options

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()
    supporting.logentireenv()

    workflow = jobManagement.JobExecution(
        Tool=
        "RunWorkflow",  # this will translate to StartWorkflow for the infacmd
        Domain=infaSettings.sourceDomain,
        ServiceName=infaSettings.sourceDIS,
        Application=application_name,
        Workflow=workflow_name,
        Wait=wait,
        OnError=errorcodes.INFACMD_WORKFLOW_FAILED,
        AsIsOptions=as_is_options)
    result = jobManagement.JobExecution.manage(workflow)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 10
0
def main(argv):
    """Exports users and groups.
    usage: exportUsersAndGroups.py [-h] -o OUTPUT_FILE [-f {false,true}]
                               [-r {false,true}]
    where:
    -f or --force: Overwrite output file if it exists
    -r or --retainpassword: If set to "false" user passwords are not exported. If "true" they will be.
    """
    thisproc = "MAIN"
    mainProc = 'exportUsersAndGroups'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    export_file_name = args.output_file
    force = args.force
    retain_password = args.retain_password

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    users_and_groups = manageSecurity.ManageSecurity(
        Tool="ExportUsersAndGroups",
        Domain=infaSettings.sourceDomain,
        ExportFile=export_file_name,
        Force=force,
        RetainPassword=retain_password,
        OnError=errorcodes.INFACMD_EXPORT_USRGRP_FAILED)

    result = manageSecurity.ManageSecurity.manage(users_and_groups)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 11
0
def main(argv):
    """List connection options for the provided connection definition.
    Usage: listConnectionOptions.py [-h] -c CONNECTION_NAME [-o OUTPUT_FILE]
    If no output file is provided, the default infaConstants.DEFAULT_CONNECTIONOPTIONSFILE will be used.
    """
    thisproc = "MAIN"
    mainProc = 'listConnectionOptions'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    connection_name = args.connection_name
    output_file = args.output_file

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    connection = manageConnection.ManageConnection(
        Tool="ListConnectionOptions",
        Domain=infaSettings.sourceDomain,
        ConnectionName=connection_name,
        OnError=errorcodes.INFACMD_LIST_CONN_OPTIONS_FAILED,
        OutputFile=output_file)

    result = manageConnection.ManageConnection.manage(connection)
    if result.rc != errorcodes.OK.rc:
        with open(output_file, 'r') as f:
            for line in f:
                result.message += line.rstrip()

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 12
0
def main(argv):
    """Import users and groups from a file. The file has to be generated by exportUsersAndGroups.py or a self-made corresponding infacmd command line.
    usage: importUsersAndGroups.py [-h] -i INPUT_FILE [-r {false,true}]
    where:
    -r determines whether (true) or not (false) existing users and groups in the target environment should be re-used.
    Check the Informatica documentation for further information on importing users and groups with infacmd.
    """
    thisproc = "MAIN"
    mainProc = 'importUsersAndGroups'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    import_file_name = args.input_file
    reuse_domain_users_and_groups = args.reuse

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    users_and_groups = manageSecurity.ManageSecurity(
        Tool="ImportUsersAndGroups",
        Domain=infaSettings.sourceDomain,
        ExportFile=import_file_name,
        ReuseDomainUsersAndGroups=reuse_domain_users_and_groups,
        OnError=errorcodes.INFACMD_IMPORT_USRGRP_FAILED)

    result = manageSecurity.ManageSecurity.manage(users_and_groups)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 13
0
def main(argv):
    """Runs a Profile.
    usage: runProfile.py [-h] -p OBJECT_PATH
    """
    thisproc = "MAIN"
    mainProc = 'runProfile'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    objectPath = args.object_path
    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()
    supporting.logentireenv()

    profile = jobManagement.JobExecution(
        Tool="RunProfile",
        Domain=infaSettings.sourceDomain,
        MrsServiceName=infaSettings.sourceModelRepository,
        DsServiceName=infaSettings.sourceDIS,
        ObjectPathAndName=objectPath,
        ObjectType="profile",
        Wait="true",
        OnError=errorcodes.INFACMD_PROFILE_FAILED)
    result = jobManagement.JobExecution.manage(profile)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 14
0
def main(argv):
    thisproc = "MAIN"
    mainProc = 'createGroup'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    group_name = args.group_name
    group_description = args.group_description

    supporting.log(logger, logging.DEBUG, thisproc,
                   'Group name is >' + group_name + '<.')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'Group description is >' + group_description + '<.')

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    group = manageSecurity.ManageSecurity(
        Tool="CreateGroup",
        Domain=infaSettings.sourceDomain,
        GroupName=group_name,
        GroupDescription=group_description,
        OnError=errorcodes.INFACMD_CREATE_GROUP_FAILED)
    result = manageSecurity.ManageSecurity.manage(group)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Ejemplo n.º 15
0
def main(argv):
    """Removes a folder from a project
    Usage: deleteFolder.py [-h] -p PROJECT_NAME -f FOLDER_NAME
    """
    thisproc = "MAIN"
    mainProc = 'deleteFolder'

    resultlogger = supporting.configurelogger(mainProc)
    logger = logging.getLogger(mainProc)

    args = parse_the_arguments(argv)

    generalSettings.getenvvars()

    supporting.log(logger, logging.DEBUG, thisproc, 'Started')
    supporting.log(logger, logging.DEBUG, thisproc,
                   'logDir is >' + generalSettings.logDir + "<.")

    project_name = args.project_name
    folder_name = args.folder_name

    infaSettings.getinfaenvvars()
    infaSettings.outinfaenvvars()

    folder = manageFolder.ManageFolder(
        Tool="DeleteFolder",
        Domain=infaSettings.sourceDomain,
        ServiceName=infaSettings.sourceModelRepository,
        ProjectName=project_name,
        Path=folder_name,
        OnError=errorcodes.INFACMD_DELETE_FOLDER_FAILED)
    result = manageFolder.ManageFolder.manage(folder)

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)