diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-07 15:55:00 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-07 15:56:36 +0800 |
commit | 83cec09282cca292056a54b50d33f6a3d7e5b48c (patch) | |
tree | 41ccc0dd6a51a1c321229c1569129868f07bade5 /testapi/testapi-client/testapiclient/pods.py | |
parent | 25ed1721025d50e7213793c714e08973e77e9b10 (diff) |
leverage authenticate decorator to identity check
Change-Id: If9248161ecb02153d0685c8f4325be96f2f1d5da
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/testapi-client/testapiclient/pods.py')
-rw-r--r-- | testapi/testapi-client/testapiclient/pods.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/testapi/testapi-client/testapiclient/pods.py b/testapi/testapi-client/testapiclient/pods.py index 81d4b9e..b73839e 100644 --- a/testapi/testapi-client/testapiclient/pods.py +++ b/testapi/testapi-client/testapiclient/pods.py @@ -61,13 +61,9 @@ class PodCreate(command.Command): 'mode should be either "metal" or "virtual.') return parser + @identity.authenticate def take_action(self, parsed_args): http_client = HTTPClient.get_Instance() - if(parsed_args.u and parsed_args.p): - response = identity.authenticate(parsed_args.u, parsed_args.p) - if "login" in response.text: - print "Authentication has failed." - return response = http_client.post(PODS_URL, User.session, parsed_args.pod) @@ -88,13 +84,8 @@ class PodDelete(command.Command): help='Delete pods using name') return parser + @identity.authenticate def take_action(self, parsed_args): http_client = HTTPClient.get_Instance() - if(parsed_args.u and parsed_args.p): - response = identity.authenticate(parsed_args.u, parsed_args.p) - if "login" in response.text: - print "Authentication has failed." - return - pods = http_client.delete(PODS_URL + "/" + parsed_args.name, - User.session) - print pods + print http_client.delete(PODS_URL + "/" + parsed_args.name, + User.session) |