Hi, I have a strange issue, I use same call for two different commcells. One commcell returns data as requested with no issues, second commcell simply returns very ‘informative’ error:
Response code: <Response n200]>
{'CVGui_GenericResp': {'@errorMessage': 'Operation failed', '@errorCode': '2'}}
I am sending the following URL:
http://mycommcell.NET:81/SearchSvc/CVWebService.svc/ExecuteQCommandcommand=qoperation execscript -sn QS_DataProtectionJobSummary -si '2020-1-1' -si '2021-3-16'
Code snippet:
def commcell_authentication(self):
"""This method is used to get token for comcells"""
for auth in self.cs_api:
pwd = self.cs_creds_'password']
pwd = bytes(pwd, encoding='utf8')
pwd = str(base64.b64encode(pwd), encoding='utf-8')
username = 'dbadmin\\' + self.cs_creds_'username']
self.cs_login_api = self.cs_login_api.replace("<<username>>", username)
self.cs_login_api = self.cs_login_api.replace("<<password>>", pwd)
response = requests.post(autht'url'] + 'Login', data = self.cs_login_api)
if response.status_code == 200:
root = ET.fromstring(response.text)
token = root.attriba'token']
headers = {'Accept': 'application/json', 'Authtoken': token, 'Content-Type': 'application/x-www-form-urlencoded'}
auth 'headers'] = headers
def get_commvault_clients(self):
"""This method is used to get history of all clients backups from past year, in both comcells"""
todays_date = datetime.datetime.today()
todays_date = "{}-{}-{}".format(todays_date.year, todays_date.month, todays_date.day)
last_year_date = datetime.datetime.today() - datetime.timedelta(days = 365)
last_year_date = "{}-1-1".format(last_year_date.year)
self.commvault_servers = e]
for api in self.cs_api:
jobs_request = api 'url'] + 'ExecuteQCommand'
jobs_response = requests.post(jobs_request, headers = api 'headers'], data = "command=qoperation execscript -sn QS_DataProtectionJobSummary -si " + "'" + str(last_year_date) + "'" + " -si " + "'" +str(todays_date) + "'")
if jobs_response.status_code == 200:
jobs = jobs_response.json()
for job in jobsn'ExecScriptOutput']t'FieldValue']:
self.commvault_servers.append(job)
return self.commvault_servers
Where is the problem and what does the error code ‘2’ means?