From: lombardofr Date: Tue, 18 Jun 2019 11:45:52 +0000 (+0200) Subject: fix bug 768 X-Git-Tag: v6.0.2rc1^2~8 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=fb0edf0369dbd3b06783a2ce95d5dbecddfad143;p=osm%2FLW-UI.git fix bug 768 Change-Id: Ic221242af66ecf4dd13059785966b38eb40670ac Signed-off-by: lombardofr --- diff --git a/lib/osm/osmclient/clientv2.py b/lib/osm/osmclient/clientv2.py index 95b4b97..30cc1f4 100644 --- a/lib/osm/osmclient/clientv2.py +++ b/lib/osm/osmclient/clientv2.py @@ -22,6 +22,7 @@ import StringIO from lib.util import Util import hashlib import os +import re from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) @@ -115,7 +116,7 @@ class Client(object): _url = "{0}/admin/v1/roles/{1}".format(self._base_path, role_id) try: - r = requests.patch(_url, json=role_data, verify=False, headers=headers) + r = requests.put(_url, json=role_data, verify=False, headers=headers) except Exception as e: log.exception(e) result['data'] = str(e) @@ -153,15 +154,14 @@ class Client(object): _url = "{0}/admin/v1/roles/{1}".format(self._base_path, id) try: - r = requests.delete(_url, params=None, verify=False, headers=headers) + r = requests.get(_url, params=None, verify=False, headers=headers) except Exception as e: log.exception(e) result['data'] = str(e) return result if r.status_code in (200, 201, 202, 204): result['error'] = False - else: - result['data'] = Util.json_loads_byteified(r.text) + result['data'] = Util.json_loads_byteified(r.text) return result def user_list(self, token): @@ -827,10 +827,10 @@ class Client(object): def _descriptor_update(self, tarf, data): # extract the package on a tmp directory - tarf.extractall('/tmp') - + tarf.extractall('/tmp') + regex = re.compile(r"^[^/]+(/[^/]+\.(yaml|yml))$", re.U) for name in tarf.getnames(): - if name.endswith(".yaml") or name.endswith(".yml"): + if regex.match(name): with open('/tmp/' + name, 'w') as outfile: yaml.safe_dump(data, outfile, default_flow_style=False) break