diff options
author | Bin Yang <bin.yang@windriver.com> | 2017-03-03 16:39:25 +0800 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2017-03-03 16:39:25 +0800 |
commit | 35362278dc5e2f5f1543f2825bf3a380444a742f (patch) | |
tree | 1ae2d06316d3578ce1102986aa02a5b14912a749 /newton | |
parent | e0010886c07924786c30fa5a55675dba4165b58d (diff) |
Refactor flavors API for newton
Change-Id: I36c579b91be6c5874804b34489d5df1a66c053d5
Issue-Id: MULTIVIM-22
Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'newton')
-rw-r--r-- | newton/newton/requests/views/flavor.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/newton/newton/requests/views/flavor.py b/newton/newton/requests/views/flavor.py index 22b84bbf..197ecd8b 100644 --- a/newton/newton/requests/views/flavor.py +++ b/newton/newton/requests/views/flavor.py @@ -76,13 +76,14 @@ class Flavors(APIView): else: wanted = None - #check if query contains name="???" - for queryone in query.split('&'): - k,v = queryone.split('=') - if k == "name": - wanted = v - break - pass + #check if query contains name="flavorname" + if query: + for queryone in query.split('&'): + k,v = queryone.split('=') + if k == "name": + wanted = v + break + pass if wanted: oldFlavors = content.pop("flavors", None) @@ -164,7 +165,7 @@ class Flavors(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) - #check if the flavor name or id is used + #check if the flavor is already created: name or id tmpresp = self.get_flavor(sess, request) content = tmpresp.json() #iterate each flavor to get extra_specs @@ -178,7 +179,7 @@ class Flavors(APIView): break pass - if existed: + if existed == True: extraResp = self.get_flavor_extra_specs(sess, flavor["id"]) extraContent = extraResp.json() if extraContent["extra_specs"]: |