Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_schedule_id(self):
"""
Gets a schedule ID dict for the schedule
Returns (int) -- schedule ID
"""
schedules_obj = Schedules(self.class_object)
return schedules_obj.get(self.schedule_name).schedule_id
"subscriptionInfo": ""
}
}
}
]
}
}
flag, response = self._cvpysdk_object.make_request('POST', self._services['RESTORE'], replicacopyjson)
if flag:
if response.json():
if "jobIds" in response.json():
return Job(self._commcell_object, response.json()['jobIds'][0])
elif "taskId" in response.json():
return Schedules(self._commcell_object).get(task_id=response.json()['taskId'])
elif "errorCode" in response.json():
error_message = response.json()['errorMessage']
o_str = 'Restore job failed\nError: "{0}"'.format(error_message)
raise SDKException('Subclient', '102', o_str)
else:
raise SDKException('Subclient', '102', 'Failed to run the restore job')
else:
raise SDKException('Response', '102')
else:
raise SDKException('Response', '101', self._update_response_(response.text))
def refresh(self):
"""Refresh the properties of the Subclient."""
self._get_subclient_properties()
self.schedules = Schedules(self)
if response is not success
"""
if flag:
if response.json():
if "jobIds" in response.json():
if len(response.json()['jobIds']) == 1:
return Job(self._commcell_object,
response.json()['jobIds'][0])
else:
joblist = []
for jobids in response.json()['jobIds']:
joblist.append(Job(self._commcell_object, jobids))
return joblist
elif "taskId" in response.json():
return Schedules(self._commcell_object).get(task_id=response.json()['taskId'])
elif "errorCode" in response.json():
o_str = 'Initializing backup failed\nError: "{0}"'.format(
response.json()['errorMessage']
)
raise SDKException('Subclient', '102', o_str)
else:
raise SDKException('Response', '102')
else:
raise SDKException(
'Response',
'101',
self._update_response_(
response.text))
if response is empty
if response is not success
"""
flag, response = self._cvpysdk_object.make_request('POST', self._RESTORE, request_json)
self._restore_association = None
if flag:
if response.json():
if "jobIds" in response.json():
return Job(self._commcell_object, response.json()['jobIds'][0])
elif "taskId" in response.json():
return Schedules(self._commcell_object).get(task_id=response.json()['taskId'])
elif "errorCode" in response.json():
error_message = response.json()['errorMessage']
o_str = 'Restore job failed\nError: "{0}"'.format(error_message)
raise SDKException('Subclient', '102', o_str)
else:
raise SDKException('Subclient', '102', 'Failed to run the restore job')
else:
raise SDKException('Response', '102')
else:
raise SDKException('Response', '101', self._update_response_(response.text))
def _get_task_id(self):
"""
Gets a schedule ID dict for the schedule
Returns (int) -- schedule ID
"""
schedules_obj = Schedules(self.class_object)
return schedules_obj.schedules.get(self.schedule_id).get('task_id')
def refresh(self):
"""Refresh the properties of the Backupset."""
self._get_backupset_properties()
self.subclients = Subclients(self)
self.schedules = Schedules(self)