def ListCheckedOutObjects(**KeyWordArguments): thisproc = "ListCheckedOutObjects" """ List Components that are currently checked out """ KeyWordArguments["Tool"] = "ListCheckOutObjects" ListCheckedOutCommand = buildCommand.build(**KeyWordArguments) output, error = executeInfacmd.execute(ListCheckedOutCommand) # The output is in the form of one object per line, with properties spearated by a comma + space. # To filter out irrelevant lines, such as "Command succesful", we keep only line that start with "MRS_PATH=" OutputLines = output.splitlines() OutputKeyValuePairLines = [ Properties.split(", ") for Properties in OutputLines if Properties.startswith("MRS_PATH=") ] # ObjectsOLD = [[KVPair.split("=", 1) for KVPair in Line] for Line in OutputKeyValuePairLines] # Each object is a dictionary, with properties as keys # Since the date field has a comma in it, its not parsed properly. For this reason we need the len == 2 filter # If the date is required, the parsing of the output should be adjusted Objects = [ dict( KVPair.split("=") for KVPair in Line if len(KVPair.split("=")) == 2) for Line in OutputKeyValuePairLines ] supporting.log(logger, logging.DEBUG, thisproc, output) return Objects
def CheckInMutiple(**KeyWordArguments): thisproc = "CheckInMultiple" """ Check in Multiple IDQ components """ for key, value in KeyWordArguments.items(): if key == "MultipleObjectPaths": ObjectPaths = KeyWordArguments["MultipleObjectPaths"] KeyWordArguments["Tool"] = "CheckIn" CheckInCommands = [] for ObjectPathName in ObjectPaths: KeyWordArguments["ObjectPathName"] = ObjectPathName CheckInCommands.append(buildCommand.build(**KeyWordArguments)) CheckInAllCommand = "\n".join(CheckInCommands) timebefore = datetime.datetime.now() output, error = executeInfacmd.execute(CheckInAllCommand) timeafter = datetime.datetime.now() duration = timeafter - timebefore supporting.log( logging.DEBUG, thisproc, "Infacmd took " + str(duration) + " seconds to check-in " + str(len(ObjectPaths)) + " objects") # output, error = (CheckInAllCommand, 0) return (output, error)
def list(logical_dis_name): thisproc = 'list' """Runs Informatica command line to list applications deployed to a DIS """ tmp_file_name = filehandling.generate_tmp_filename() supporting.log(logger, logging.DEBUG, thisproc, 'Started') actual_dis_name = infaSettings.get_dis_name(logical_dis_name) infaSettings.getinfaenvvars() run_command = buildCommand.build(Tool='ListApplications', Domain=infaSettings.sourceDomain, ServiceName=actual_dis_name, OutputFile=tmp_file_name) masked_run_command = mask_password(run_command) log(logger, logging.DEBUG, __name__, "RunCommand is >" + masked_run_command + "<.") result = executeInfacmd.execute(run_command) app_list = filehandling.convert_content_to_array(tmp_file_name) filehandling.removefile(tmp_file_name) supporting.log(logger, logging.DEBUG, thisproc, 'Completed') return result, app_list
def CheckIn(**KeyWordArguments): """Check-in IDQ Components""" KeyWordArguments["Tool"] = "CheckIn" CheckInCommand = buildCommand.build(**KeyWordArguments) output, error = executeInfacmd.execute(CheckInCommand) return (output, error)
def import_infadeveloper(**KeyWordArguments): """Import IDQ Components""" KeyWordArguments["Tool"] = "Import" ImportCommand = buildCommand.build(**KeyWordArguments) result = executeInfacmd.execute(ImportCommand, constants.DEPLOYARTIFACT) return result
def CreateFolder(**KeyWordArguments): """Create IDQ Folder""" KeyWordArguments["Tool"] = "CreateFolder" CreateFolder = buildCommand.build(**KeyWordArguments) output, error = executeInfacmd.execute(CreateFolder) return (output, error)
def export_infadeveloper(**KeyWordArguments): thisproc = "export_infadeveloper" KeyWordArguments["Tool"] = "Export" ExportCommand = buildCommand.build(**KeyWordArguments) supporting.log(logger, logging.INFO, thisproc, "ExportCommand is >" + ExportCommand + "<.") result = executeInfacmd.execute(ExportCommand, constants.CREATEARTIFACT) return result
def set_app_privileges(**KeyWordArguments): thisproc = "set_app_privileges" KeyWordArguments["Tool"] = "AppPrivileges" deploy_command = buildCommand.build(**KeyWordArguments) supporting.log(logger, logging.INFO, thisproc, "Command is >" + deploy_command + "<.") result = executeInfacmd.execute(deploy_command, constants.DEPLOYARTIFACT) return result
def redeploy_iar_file(**KeyWordArguments): thisproc = "redeploy_iar_file" KeyWordArguments["Tool"] = "RedeployIAR" deploy_command = buildCommand.build(**KeyWordArguments) supporting.log(logger, logging.INFO, thisproc, "Command is >" + deploy_command + "<.") result = executeInfacmd.execute(deploy_command, constants.DEPLOYARTIFACT) return result
def create_iar_file(**KeyWordArguments): thisproc = "create_iar_file" KeyWordArguments["Tool"] = "CreateIAR" create_command = buildCommand.build(**KeyWordArguments) supporting.log(logger, logging.INFO, thisproc, "Command is >" + create_command + "<.") result = executeInfacmd.execute(create_command, constants.CREATEARTIFACT) return result
def manage(self): RunCommand = buildCommand.build(**self.keyword_arguments) log(self.logger, logging.INFO, __name__, "RunCommand is >" + RunCommand + "<.") result = executeInfacmd.execute(RunCommand) if(result.rc != errorcodes.OK.rc): oldResult = result.message result = self.keyword_arguments["OnError"] result.message = oldResult return (result)
def manage(self): RunCommand = buildCommand.build(**self.keyword_arguments) if self.pre_command is None: log(self.logger, logging.INFO, __name__, "no pre_command provided.") else: log(self.logger, logging.INFO, __name__, "preCommand is >" + self.pre_command + "<.") log(self.logger, logging.INFO, __name__, "RunCommand is >" + RunCommand + "<.") result = executeInfacmd.execute(command=RunCommand, pre_command=self.pre_command) if result.rc != errorcodes.OK.rc: oldResult = result.message result = self.keyword_arguments["OnError"] result.message = oldResult return (result)