X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osmclient%2Fsol005%2Fwim.py;h=30b36e7c9e3b530d8b59f32b81393e148206af28;hb=09fa3d4dffb1fd9ea427f32a32264dd3bda56543;hp=defc536a5d1c39c786370b921854dc99526c53dc;hpb=5da3f209f7595167bf762e71236076a637244c49;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/wim.py b/osmclient/sol005/wim.py index defc536..30b36e7 100644 --- a/osmclient/sol005/wim.py +++ b/osmclient/sol005/wim.py @@ -51,10 +51,10 @@ class Wim(object): def _get_id_for_wait(self, name): # Returns id of name, or the id itself if given as argument for wim in self.list(): - if name == wim['name']: + if name == wim['uuid']: return wim['uuid'] for wim in self.list(): - if name == wim['uuid']: + if name == wim['name']: return wim['uuid'] return '' @@ -77,8 +77,8 @@ class Wim(object): http_code, resp = self._http.post_cmd(endpoint=self._apiBase, postfields_dict=wim_account) - #print 'HTTP CODE: {}'.format(http_code) - #print 'RESP: {}'.format(resp) + #print('HTTP CODE: {}'.format(http_code)) + #print('RESP: {}'.format(resp)) if http_code in (200, 201, 202, 204): if resp: resp = json.loads(resp) @@ -116,17 +116,13 @@ class Wim(object): #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) + #print('HTTP CODE: {}'.format(http_code)) + #print('RESP: {}'.format(resp)) if http_code in (200, 201, 202, 204): if wait: - # 'resp' may be None. - # In that case, 'resp['id']' cannot be used. - # In that case, 'resp['id']' cannot be used, so use the previously obtained id instead + # 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 - if resp: - resp = json.loads(resp) - wait_id = resp.get('id') # Wait for status for WIM instance update self._wait(wait_id) else: @@ -141,7 +137,7 @@ class Wim(object): raise ClientException("failed to update wim {} - {}".format(wim_name, msg)) def update_wim_account_dict(self, wim_account, wim_input): - print (wim_input) + print(wim_input) wim_account['wim_type'] = wim_input['wim_type'] wim_account['description'] = wim_input['description'] wim_account['wim_url'] = wim_input['url'] @@ -167,9 +163,9 @@ class Wim(object): querystring = '?FORCE=True' http_code, resp = self._http.delete_cmd('{}/{}{}'.format(self._apiBase, wim_id, querystring)) - # print 'HTTP CODE: {}'.format(http_code) - # print 'RESP: {}'.format(resp) - # print 'WIM_ID: {}'.format(wim_id) + # print('HTTP CODE: {}'.format(http_code)) + # print('RESP: {}'.format(resp)) + # print('WIM_ID: {}'.format(wim_id)) if http_code == 202: if wait: # 'resp' may be None.