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
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
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)
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)
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)
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)
def runit(self, arguments): """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 = "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 + "<.") application_name = args.application_name mapping_name = args.mapping_name pushdown_type = args.pushdown_type optimization_level = args.optimization_level os_profile = args.os_profile 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" 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
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)
def runit(self, arguments): """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: arguments: The command line arguments (none actually at the moment) """ thisproc = "runit" args = self.parse_the_arguments(arguments) logger = self.logger self.custom_logger.log(logger, logging.DEBUG, thisproc, 'Started') self.custom_logger.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalsettings.logDir + "<.") # Check requirements for artifact generation generalsettings.getenvvars() self.fitnesse_settings.getfitnesseenvvars() self.fitnesse_settings.outfitnesseenvvars() self.result = self.fitnesse_checks.fitnesse_artifact_checks( self.fitnesse_settings) if self.result.rc == err.IGNORE.rc: # deploylist is not mandatory since 2020-02-09 self.custom_logger.log(logging, self.result.level, thisproc, 'Artifact ignored.') self.result = err.OK else: if self.result.rc != err.OK.rc: self.custom_logger.log( logger, logging.ERROR, thisproc, 'FitNesse Artifact Checks failed with >' + self.result.message + "<.") self.custom_logger.writeresult(self.result_logger, self.result) else: builder = create_fitnesse_artifact.helpers.artifact.BuildFitNesseArtifact( self.fitnesse_settings, self.fitnesse_settings.fitnessedeploylist) self.result = builder.processList() self.custom_logger.writeresult(self.result_logger, self.result) self.custom_logger.log( logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(self.result.rc) + '< and result code >' + self.result.code + "<.") # supporting.writeresult(resultlogger, result) # supporting.exitscript(resultlogger, result) return self.result
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): """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)
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): """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)
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)
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)
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)
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)
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)
def runit(self, arguments): """Runs a Profile. usage: runProfile.py [-h] -p OBJECT_PATH """ 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 + "<.") object_path = args.object_path os_profile = args.os_profile as_is_options = args.as_is_options infaSettings.getinfaenvvars() infaSettings.outinfaenvvars() profile = jobManagement.JobExecution( Tool="RunProfile", Domain='$' + infaConstants.varSourceDomain, DsServiceName='$' + infaConstants.varSourceDIS, MrsServiceName='$' + infaConstants.varSourceModelRepository, ObjectPathAndName=object_path, ObjectType="profile", Wait="true", OnError=errorcodes.INFACMD_PROFILE_FAILED, OperatingSystemProfile=os_profile, AsIsOptions=as_is_options) result = jobManagement.JobExecution.manage(profile) supporting.log( self.logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc) + '< and result code >' + result.code + "<.") return result
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)
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 generate_tmp_filename(): generalSettings.getenvvars() tmp_file_name = generalSettings.logDir + '/' + randomize.randomStringDigits( ) + '.tmp' return tmp_file_name