diff options
author | Bin Yang <bin.yang@windriver.com> | 2019-05-28 05:32:54 +0000 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2019-05-28 05:32:54 +0000 |
commit | 9154720606df1bb43e501a63cd23beca77a409eb (patch) | |
tree | 8c90d5891f45c28a408bc52100ff78c696186380 /share/newton_base/openoapi/flavor.py | |
parent | eb1e6c75c236bd88a3c371befebcb56fa4f9f090 (diff) |
Fix issue of v1/.../tenants API
Fix all openoapi v1 which use logger
Change-Id: Iaf82c1ca17959725531f6b340e3e770844dd222c
Issue-ID: MULTICLOUD-657
Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'share/newton_base/openoapi/flavor.py')
-rw-r--r-- | share/newton_base/openoapi/flavor.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/share/newton_base/openoapi/flavor.py b/share/newton_base/openoapi/flavor.py index 8dcd10f6..8809e83b 100644 --- a/share/newton_base/openoapi/flavor.py +++ b/share/newton_base/openoapi/flavor.py @@ -39,9 +39,13 @@ class Flavors(APIView): ("extra_specs", "extraSpecs"), ] + def __init__(self): + super(Flavors, self).__init__() + self._logger = logger + def _convert_extra_specs(self, extra_specs_vfc, extra_specs_openstack, reverse=False): if reverse == False: - #from extraSpecs to extra_specs + # from extraSpecs to extra_specs for spec in extra_specs_vfc: extra_specs_openstack[spec['keyName']] = spec['value'] else: @@ -86,7 +90,7 @@ class Flavors(APIView): else: wanted = None - #check if query contains name="flavorname" + # check if query contains name="flavorname" if query: for queryone in query.split('&'): k,v = queryone.split('=') @@ -101,7 +105,7 @@ class Flavors(APIView): if wanted == flavor["name"]: content["flavors"].append(flavor) - #iterate each flavor to get extra_specs + # iterate each flavor to get extra_specs for flavor in content["flavors"]: extraResp = self._get_flavor_extra_specs(sess, flavor["id"]) extraContent = extraResp.json() @@ -112,7 +116,7 @@ class Flavors(APIView): VimDriverUtils.replace_key_by_mapping(flavor, self.keys_mapping) - #add extra keys + # add extra keys vim_dict = { "vimName": vim["name"], "vimId": vim["vimId"], @@ -418,9 +422,12 @@ class Flavors(APIView): return resp - class APIv1Flavors(Flavors): + def __init__(self): + super(APIv1Flavors, self).__init__() + self._logger = logger + def get(self, request, cloud_owner="", cloud_region_id="", tenantid="", flavorid=""): self._logger.info("%s, %s" % (cloud_owner, cloud_region_id)) |