def run_internal(query_login, cleanup, noisy): screen('\nRunning All Workflows Internally:', noisy) client = login(query_login, noisy) sep = '====================================================================================================' wf_list = _get_workflows(client, noisy, cleanup) wf_count = len(wf_list) success_count = 0 for i in range(len(wf_list)): screen('\n\n\n{}[{}/{}]'.format(sep, i + 1, wf_count), noisy) res = wf_list[i].run() if res: success_count += 1 screen('\n\n{} of {} workflows SUCCEEDED'.format(success_count, wf_count), noisy) return success_count, wf_count
try: # Create Volume vol = create_vol(self.client, self.config[KEY_VOL], self.noisy) # Create a volume collection volcoll1 = create_volume_collection(self.client, self.config[KEY_VOLCOLL], self.noisy) # Associate a volume with the volume collection associate_vol(self.client, vol.id, volcoll1, self.noisy) # Create a protection schedule ps_name = self.config[KEY_PS] create_protection_schedule(self.client, ps_name, volcoll1.attrs['id'], self.noisy) if self.cleanup: self._do_cleanup(ps_name, self.config[KEY_VOLCOLL], vol.attrs['name'], self.noisy) except NimOSAPIError: traceback.print_exc() return False return True if __name__ == '__main__': cur_noisy = True filename = os.path.basename(__file__) query_login, cleanup = handle_params(filename, sys.argv) client = login(query_login, cur_noisy) screen(' ', cur_noisy) wf = protect_volume(client, cur_noisy, cleanup) wf.run()