diff options
author | asteroide <thomas.duval@orange.com> | 2015-09-11 17:45:54 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2015-09-11 17:45:54 +0200 |
commit | 0c488612d6e33c5c03794d9858ace0d116b78fb4 (patch) | |
tree | 807bb2b5a3bcac0c3550288455867b0f992e3d03 /moonclient | |
parent | ad2869493fc54f8c3f7f91c4d4f44e24b9048238 (diff) |
Debug all the tenant commands in moonclient and fix some bugs in opnfv-moon related to tenant.
Change-Id: I1d21df2a55545582a98c17181255ab53cab5689b
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/intraextension.py | 14 | ||||
-rw-r--r-- | moonclient/moonclient/shell.py | 2 | ||||
-rw-r--r-- | moonclient/moonclient/tenants.py | 22 |
3 files changed, 19 insertions, 19 deletions
diff --git a/moonclient/moonclient/intraextension.py b/moonclient/moonclient/intraextension.py index c46927cd..1842baa4 100644 --- a/moonclient/moonclient/intraextension.py +++ b/moonclient/moonclient/intraextension.py @@ -37,9 +37,9 @@ class IntraExtensionCreate(Command): def take_action(self, parsed_args): post_data = { - "name": parsed_args.name, - "policymodel": parsed_args.policy_model, - "description": parsed_args.description + "intra_extension_name": parsed_args.name, + "intra_extension_model": parsed_args.policy_model, + "intra_extension_description": parsed_args.description } ie = self.app.get_url("/v3/OS-MOON/intra_extensions", post_data=post_data, authtoken=True) if "id" not in ie: @@ -59,11 +59,11 @@ class IntraExtensionList(Lister): def take_action(self, parsed_args): ie = self.app.get_url("/v3/OS-MOON/intra_extensions", authtoken=True) - if "intra_extensions" not in ie: - raise Exception("Error in command {}".format(ie)) + # if "intra_extensions" not in ie: + # raise Exception("Error in command {}".format(ie)) return ( - ("id",), - ((_id, ) for _id in ie["intra_extensions"]) + ("id", "name", "model"), + ((_id, ie[_id]["name"], ie[_id]["model"]) for _id in ie.keys()) ) diff --git a/moonclient/moonclient/shell.py b/moonclient/moonclient/shell.py index 5005095e..10b96511 100644 --- a/moonclient/moonclient/shell.py +++ b/moonclient/moonclient/shell.py @@ -100,7 +100,7 @@ class MoonClient(App): method = "DELETE" self.log.debug("\033[32m{} {}\033[m".format(method, url)) conn = httplib.HTTPConnection(self.host, self.port) - self.log.info("Host: {}:{}".format(self.host, self.port)) + self.log.debug("Host: {}:{}".format(self.host, self.port)) headers = { "Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", diff --git a/moonclient/moonclient/tenants.py b/moonclient/moonclient/tenants.py index b51b00ee..cc7c1de0 100644 --- a/moonclient/moonclient/tenants.py +++ b/moonclient/moonclient/tenants.py @@ -71,7 +71,7 @@ class TenantAdd(Command): if parsed_args.admin: post_data["tenant_intra_admin_extension_id"] = parsed_args.admin if parsed_args.desc: - post_data["description"] = parsed_args.desc + post_data["tenant_description"] = parsed_args.desc tenants = self.app.get_url("/v3/OS-MOON/tenants", post_data=post_data, authtoken=True) @@ -154,20 +154,20 @@ class TenantSet(Command): def take_action(self, parsed_args): post_data = dict() - post_data["id"] = parsed_args.tenant_id + post_data["tenant_id"] = parsed_args.tenant_id if parsed_args.name: - post_data["name"] = parsed_args.tenant_name - if parsed_args.authz: - post_data["intra_authz_extension_id"] = parsed_args.authz - if parsed_args.admin: - post_data["intra_admin_extension_id"] = parsed_args.admin - if parsed_args.desc: - post_data["description"] = parsed_args.desc - tenants = self.app.get_url("/v3/OS-MOON/tenants/{}".format(post_data["id"]), + post_data["tenant_name"] = parsed_args.tenant_name + if parsed_args.authz is not None: + post_data["tenant_intra_authz_extension_id"] = parsed_args.authz + if parsed_args.admin is not None: + post_data["tenant_intra_admin_extension_id"] = parsed_args.admin + if parsed_args.desc is not None: + post_data["tenant_description"] = parsed_args.desc + tenants = self.app.get_url("/v3/OS-MOON/tenants/{}".format(post_data["tenant_id"]), post_data=post_data, authtoken=True) return ( - ("id", "name", "description", "intra_authz_extension_id", "intra_admin_extension_id"), + ("id", "name", "description", "authz", "admin"), (( tenant_id, tenants[tenant_id]["name"], |