def runit(self, arguments):
        """Deploys a scheduler artifact.
        """
        thisproc = "runit"

        args = self.parse_the_arguments(arguments)

        generalSettings.getenvvars()

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

        # Check requirements for artifact generation
        generalSettings.getenvvars()
        settings.getschedulerenvvars()
        settings.outschedulerenvvars()

        result = schedulerChecks.schedulerartifactchecks()
        if result.rc != 0:
            supporting.log(self.logger, logging.ERROR, thisproc,
                           'Scheduler Artifact Checks failed with >' + result.message + "<.")
            supporting.exitscript(self.resultlogger, result)

        #        result = artifact.processList(settings.schedulerdeploylist)

        supporting.log(self.logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc)
                       + '< and result code >' + result.code + "<.")
        #    supporting.writeresult(resultlogger, result)
        return result
Exemple #2
0
    def runit(self, arguments):
        """Creates a scheduler artifact.
        """
        thisproc = "runit"

        args = self.parse_the_arguments(arguments)

        generalSettings.getenvvars()

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

        # Check requirements for artifact generation
        generalSettings.getenvvars()
        settings.getschedulerenvvars()
        settings.outschedulerenvvars()

        result = schedulerChecks.schedulerartifactchecks()
        if result.rc == err.IGNORE.rc:
            # deploylist is not mandatory since 2020-02-09
            supporting.log(logging, result.level, thisproc, 'Artifact ignored.')
            result = err.OK
        else:
            if result.rc != 0:
                supporting.log(self.logger, logging.ERROR, thisproc,
                               'Scheduler Artifact Checks failed with >' + result.message + "<.")
                supporting.exitscript(self.resultlogger, result)
            else:
                result = artifact.processList(settings.schedulerdeploylist)

        supporting.log(self.logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc)
                       + '< and result code >' + result.code + "<.")
        #    supporting.writeresult(resultlogger, result)
        return result
Exemple #3
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)
Exemple #4
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)
Exemple #5
0
def main(argv):
    """Deploy the Oracle artifact to the target environment.
    Usage: deployOracle.py [-h] -s SCHEMA_NAME
    The module uses environment variables to steer the deployment, like target Oracle database, connections and such.
    For more information check the deployOracle docs.
    """
    thisproc = "MAIN"
    mainProc = 'deployOracle'

    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 + "<.")

    schema = args.schema_name
    supporting.log(logger, logging.INFO, thisproc,
                   "Schema to deployed is >" + schema + "<.")
    depl = DeployOracle(schema)
    result = depl.deployArtifact()
    supporting.exitscript(resultlogger, result)
Exemple #6
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)
Exemple #7
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)
Exemple #8
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)
Exemple #9
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)
Exemple #10
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)
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 + "<.")

    settings.getinfaenvvars()
    settings.outinfaenvvars()

    # Check requirements for artifact generation
    result = infaArtifactChecks.infadeploychecks()
    if result.rc == err.IGNORE.rc:
        # deploylist is not mandatory since 2020-02-09
        supporting.log(logging, result.level, thisproc, 'Artifact ignored.')
        result = err.OK
    else:
        if result.rc != err.OK.rc:
            supporting.log(
                logger, logging.ERROR, thisproc,
                'Informatica Platform Artifact Checks failed with >' +
                result.message + "<.")
            supporting.exitscript(resultlogger, result)
        else:
            supporting.log(
                logger, logging.DEBUG, thisproc,
                'Start processing deploy list >' + settings.infadeploylist +
                "<.")
            result = artifact.processList(infaConstants.DEPLOYARTIFACT,
                                          settings.infadeploylist)
            supporting.log(
                logger, logging.DEBUG, thisproc,
                'Deploy list >' + settings.infadeploylist +
                "< process returned >" + str(result.rc) + "<.")

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
def main(argv):
    """Creates an Informatica Platform application iar file that can be deployed to a DIS later on
    Usage: createInformaticaPlatformApp.py [-h]
    The module uses environment variables to steer the creation of the archive file
    """
    thisproc = "MAIN"
    mainProc = 'createInformaticaPlatformApp'

    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 + "<.")

    settings.getinfaenvvars()
    settings.outinfaenvvars()

    # Check requirements for artifact generation
    result = infaAppChecks.infa_deploy_checks()
    if result.rc == err.IGNORE.rc:
        # deploylist is not mandatory since 2020-02-09
        supporting.log(logging, result.level, thisproc, 'Apps ignored.')
        result = err.OK
    else:
        if result.rc != err.OK.rc:
            supporting.log(
                logger, logging.ERROR, thisproc,
                'Informatica Platform App Checks failed with >' +
                result.message + "<.")
            supporting.exitscript(resultlogger, result)
        else:
            supporting.log(
                logger, logging.DEBUG, thisproc,
                'Start processing deploy list >' +
                settings.infa_app_deploylist + "<.")
            result = artifact.processList(infaConstants.CREATE_APP,
                                          settings.infa_app_deploylist)
            supporting.log(
                logger, logging.DEBUG, thisproc,
                'Deploy list >' + settings.infa_app_deploylist +
                "< process returned >" + str(result.rc) + "<.")

    supporting.log(
        logger, logging.DEBUG, thisproc, 'Completed with return code >' +
        str(result.rc) + '< and result code >' + result.code + "<.")
    supporting.exitscript(resultlogger, result)
Exemple #13
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)
Exemple #14
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)
Exemple #15
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)
def main(argv):
    """Creates a FitNesse artifact, consisting on collected test directories and files
    It uses a deploy list that contains subdirectories.
    Module uses environment variables that steer the artifact creation.

    Args:
        None
    """
    thisproc = "MAIN"
    mainProc = 'CreateFitNesseArtifact'

    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 + "<.")

    # Check requirements for artifact generation
    generalsettings.getenvvars()
    settings.getfitnesseenvvars()
    settings.outfitnesseenvvars()

    result = fitnessechecks.fitnesseartifactchecks()
    if result.rc == err.IGNORE.rc:
        # deploylist is not mandatory since 2020-02-09
        supporting.log(logging, result.level, thisproc, 'Artifact ignored.')
        result = err.OK
    else:
        if result.rc != err.OK.rc:
            supporting.log(
                logger, logging.ERROR, thisproc,
                'FitNesse Artifact Checks failed with >' + result.message +
                "<.")
            supporting.exitscript(resultlogger, result)
        else:
            result = cicd.fitnesse.artifact.processList(
                settings.fitnessedeploylist)

    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)
Exemple #17
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)
Exemple #18
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)
Exemple #19
0
def main(argv):
    thisproc = "MAIN"
    mainProc = 'importConnections'

    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 + "<.")

    if len(argv) < 2:
        supporting.log(logger, logging.ERROR, thisproc,
                       'No import file and/or control file provided.')
        result = errorcodes.INFACMD_NOIMPORTFILENAME
        supporting.exitscript(resultlogger, result)

    #   mandatory
    input_file = argv[0] if len(
        argv) > 0 else infaConstants.DEFAULT_IMPORT_CONNECTIONSFILE
    import_control_file = argv[1] if len(argv) > 1 else ""
    # optional

    infaSettings.getinfaenvvars()
    #    infaSettings.outinfaenvvars()

    connection = manageConnection.ManageConnection(
        Tool="ImportConnections",
        Domain=infaSettings.sourceDomain,
        ImportControlfile=import_control_file,
        ImportFilePath=input_file,
        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)
Exemple #20
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)
def main(argv):
    """Creates an Oracle artifact, consisting on collected sql files
    It uses a deploy list that contains schema and init.sql. Check the OracleArtifact docs and examples for more info.
    Module uses environment variables that steer the artifact creation.
    """
    thisproc = "MAIN"
    mainProc = 'CreateOracleArtifact'

    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 + "<.")

    # Check requirements for artifact generation
    generalsettings.getenvvars()
    settings.getdbenvvars()
    settings.outdbenvvars()

    result = dbchecks.databaseartifactchecks()
    if result.rc == err.IGNORE.rc:
        # deploylist is not mandatory since 2020-02-09
        supporting.log(logging, result.level, thisproc, 'Artifact ignored.')
        result = err.OK
    else:
        if result.rc != 0:
            supporting.log(logger, logging.ERROR, thisproc,
                           'Database Artifact Checks failed with >' + result.message + "<.")
            supporting.exitscript(resultlogger, result)
        else:
            result = cicd.database.artifact.processList(settings.dbdeploylist)

    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)
Exemple #22
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)
Exemple #23
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)
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
    # if there is no deploylist, then ignore building the artifact
    result = infachecks.infaartifactchecks()
    if result.rc == err.IGNORE.rc:
        # deploylist is not mandatory since 2020-02-09
        supporting.log(logging, result.level, thisproc, 'Artifact ignored.')
        result = err.OK
    else:
        if result.rc != 0:
            supporting.log(logger, logging.ERROR, thisproc,
                           'Informatica Platform Artifact Checks failed with >' + result.message + "<.")
            supporting.exitscript(resultlogger, result)
        else:
            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)
Exemple #25
0
        supporting.log(self.logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.")

        # Check requirements for artifact generation
        generalSettings.getenvvars()
        settings.getschedulerenvvars()
        settings.outschedulerenvvars()

        result = schedulerChecks.schedulerartifactchecks()
        if result.rc == err.IGNORE.rc:
            # deploylist is not mandatory since 2020-02-09
            supporting.log(logging, result.level, thisproc, 'Artifact ignored.')
            result = err.OK
        else:
            if result.rc != 0:
                supporting.log(self.logger, logging.ERROR, thisproc,
                               'Scheduler Artifact Checks failed with >' + result.message + "<.")
                supporting.exitscript(self.resultlogger, result)
            else:
                result = artifact.processList(settings.schedulerdeploylist)

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


if __name__ == '__main__':
    create_artifact = CreateSchedulerArtifact(sys.argv[1:], log_on_console=True)
    result = create_artifact.runit(create_artifact.arguments)
    supporting.exitscript(create_artifact.resultlogger, result)
Exemple #26
0
            Example:
            runMapping myApp myMapping Source 3 "-ParameterSet myParameterSet"
            It is important to supply the AsIsOptions as one single string
        """
        mapping = jobManagement.JobExecution(
            pre_command=self.pre_command,
            Tool="RunMapping",
            Domain='$' + infaConstants.varSourceDomain,
            ServiceName='$' + infaConstants.varSourceDIS,
            Application=application_name,
            Mapping=mapping_name,
            PushdownType=pushdown_type,
            OptimizationLevel=optimization_level,
            Wait="true",
            OnError=errorcodes.INFACMD_MAPPING_FAILED,
            OperatingSystemProfile=os_profile,
            AsIsOptions=as_is_options)
        result = jobManagement.JobExecution.manage(mapping)

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


if __name__ == '__main__':
    infa = ExecuteInformaticaMapping(sys.argv[1:], log_on_console=True)
    result = infa.runit(infa.arguments)
    supporting.exitscript(infa.resultlogger, result)
        args = self.parse_the_arguments(arguments)

        generalSettings.getenvvars()

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

        # Check requirements for artifact generation
        generalSettings.getenvvars()
        settings.getschedulerenvvars()
        settings.outschedulerenvvars()

        result = schedulerChecks.schedulerartifactchecks()
        if result.rc != 0:
            supporting.log(self.logger, logging.ERROR, thisproc,
                           'Scheduler Artifact Checks failed with >' + result.message + "<.")
            supporting.exitscript(self.resultlogger, result)

        #        result = artifact.processList(settings.schedulerdeploylist)

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


if __name__ == '__main__':
    deploy_artifact = DeploySchedulerArtifact(sys.argv[1:], log_on_console=True)
    result = deploy_artifact.runit(deploy_artifact.arguments)
    supporting.exitscript(deploy_artifact.resultlogger, result)