- with open(wim_port_mapping, 'r') as f:
- wim_config['wim_port_mapping'] = yaml.safe_load(f.read())
- wim_account['config'] = wim_config
- #wim_account['config'] = json.dumps(wim_config)
- http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,wim['_id']),
- postfields_dict=wim_account)
- #print 'HTTP CODE: {}'.format(http_code)
- #print 'RESP: {}'.format(resp)
- if http_code in (200, 201, 202, 204):
- if wait:
- # In this case, 'resp' always returns None, so 'resp['id']' cannot be used.
- # Use the previously obtained id instead.
- wait_id = wim_id_for_wait
- # Wait for status for WIM instance update
- self._wait(wait_id)
- else:
- pass
- else:
- msg = ""
- if resp:
- try:
- msg = json.loads(resp)
- except ValueError:
- msg = resp
- raise ClientException("failed to update wim {} - {}".format(wim_name, msg))
+ with open(wim_port_mapping, "r") as f:
+ wim_config["wim_port_mapping"] = yaml.safe_load(f.read())
+ wim_account["config"] = wim_config
+ # wim_account['config'] = json.dumps(wim_config)
+ http_code, resp = self._http.patch_cmd(
+ endpoint="{}/{}".format(self._apiBase, wim["_id"]),
+ postfields_dict=wim_account,
+ )
+ # print('HTTP CODE: {}'.format(http_code))
+ # print('RESP: {}'.format(resp))
+ # if http_code in (200, 201, 202, 204):
+ if wait:
+ # In this case, 'resp' always returns None, so 'resp['id']' cannot be used.
+ # Use the previously obtained id instead.
+ wait_id = wim_id_for_wait
+ # Wait for status for WIM instance update
+ self._wait(wait_id, wait)
+ # else:
+ # pass
+ # else:
+ # msg = ""
+ # if resp:
+ # try:
+ # msg = json.loads(resp)
+ # except ValueError:
+ # msg = resp
+ # raise ClientException("failed to update wim {} - {}".format(wim_name, msg))