From 57769d84915e4daef2166b49cfb19efdea826562 Mon Sep 17 00:00:00 2001 From: Roberto Mello Date: Tue, 2 Jul 2019 09:42:40 -0600 Subject: [PATCH] Fixed bugs in simple_mount and unmount_image that prevented them from working. Made some typographical corrections. --- Actifio/Actifio.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Actifio/Actifio.py b/Actifio/Actifio.py index 47389a3..f37061a 100644 --- a/Actifio/Actifio.py +++ b/Actifio/Actifio.py @@ -524,7 +524,7 @@ def get_jobs(self, **kwargs): ''' try: lsjob_out = self.run_uds_command('info', 'lsjob', {'filtervalue': kwargs}) - lsjobhist_out = self.run_uds_command( 'info', 'lsjobhistory', {'filtervalue': kwargs}) + lsjobhist_out = self.run_uds_command('info', 'lsjobhistory', {'filtervalue': kwargs}) except: raise else: @@ -647,7 +647,7 @@ def clone_database(self, source_hostname="", source_appname="", source_applicati This method creates a virtual clone of Oracle or SQL server database. - Agrs: + Args: :source_hostname: Hostname of the source host where the database was captured from :source_appname: source application name, or the database name @@ -845,9 +845,6 @@ def clone_database(self, source_hostname="", source_appname="", source_applicati mountimage_args.__setitem__('parts', dbnames) provisioningoptions = "" + provisioningoptions + "" - - # print(provisioningoptions) - mountimage_args.__setitem__('restoreoption', {'provisioningoptions': provisioningoptions}) try: @@ -915,7 +912,7 @@ def simple_mount(self, source_application=None, target_host=None, mount_image=No *Else* - :source_application (required): ActApplication object refereing to source application + :source_application (required): ActApplication object referring to source application *If not target-host is None* @@ -970,7 +967,7 @@ def simple_mount(self, source_application=None, target_host=None, mount_image=No if mount_image is None: raise ActUserError("Unable to find a suitable image for the 'restoretime' and 'strict_policy' criteria.") - mountimage_args.__setitem__('image', mount_image.imagename) + mountimage_args.__setitem__('image', mount_image.printable) if isinstance(target_host, ActHost): if source_application.friendlytype == "VMBackup": @@ -1022,19 +1019,18 @@ def simple_mount(self, source_application=None, target_host=None, mount_image=No # get the list of restore options restoreopts = mount_image.restoreoptions('mount', target_host) - restoreopts_data = [] for opt in restoreopts: kwargs_opt = kwargs.get(opt.name) if kwargs_opt is not None: - restoreopts_data.append(opt.name + "-" + + "=" + str(kwargs_opt)) + #restoreopts_data.append(opt.name + "-" + + "=" + str(kwargs_opt)) + restoreopts_data.append('{}={}'.format(opt.name, str(kwargs_opt))) if len(restoreopts_data) != 0: mountimage_args.__setitem__('restoreoption', ','.join(restoreopts_data)) mountimage_out = self.run_uds_command('task', 'mountimage', mountimage_args) - result_job_name = mountimage_out['result'].split(" ")[0] result_image_name = mountimage_out['result'].split(" ")[3] @@ -1080,5 +1076,8 @@ def unmount_image (self, image=None, delete=True, nowait=True, pre_script="", po if len(script_data) != 0: udsargs.__setitem__('script', ';'.join(script_data)) - udsreturn = self.run_uds_command("task","unmountimage", udsargs) + udsreturn = self.run_uds_command("task", "unmountimage", udsargs) + result_job_name = udsreturn['result'].split(" ")[0] + + return self.get_jobs(jobname=result_job_name)[0]