summaryrefslogtreecommitdiff
path: root/heatclient/shell.py
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2013-11-20 13:22:44 +0000
committerSteven Hardy <shardy@redhat.com>2013-11-27 19:13:06 +0000
commit2706b48159e8937b4ef266f194a158ba60e2f36d (patch)
treef270133135a7c00fe4e8e5481bae330f52eb578a /heatclient/shell.py
parentfc9bee3458ae86860d752d022d2e188246b9cfd9 (diff)
downloadpython-heatclient-2706b48159e8937b4ef266f194a158ba60e2f36d.tar.gz
Make tokens work with --os-no-client-auth
Currently --os-no-client-auth assumes you'll only ever want to pass a username and password to the standalone auth_password middleware, but it's also valid to pass a token and endpoint, which can then be used to either connect to a normal (non-standalone) Heat without needing the client to connect to keystone, or pass a token to custom auth middleware in standalone mode where tokens are accepted. e.g: heat --os-no-client-auth --heat-url http://127.0.0.1:8004/v1/<tenant ID> --os-auth-token <a token> stack-list Change-Id: Ie22c85ba5b3b987505f4d6204b4dd6ff03e0d912 Closes-Bug: #1252248
Diffstat (limited to 'heatclient/shell.py')
-rw-r--r--heatclient/shell.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/heatclient/shell.py b/heatclient/shell.py
index b254964..7d7fb39 100644
--- a/heatclient/shell.py
+++ b/heatclient/shell.py
@@ -299,20 +299,26 @@ class HeatShell(object):
" or a token via --os-auth-token or"
" env[OS_AUTH_TOKEN]")
- if not (args.os_tenant_id or args.os_tenant_name):
- raise exc.CommandError("You must provide a tenant_id via"
- " either --os-tenant-id or via"
- " env[OS_TENANT_ID]")
-
- if not args.os_auth_url:
- raise exc.CommandError("You must provide an auth url via"
- " either --os-auth-url or via "
- "env[OS_AUTH_URL]")
- if args.os_no_client_auth and not args.heat_url:
- raise exc.CommandError("If you specify --os-no-client-auth"
- " you must also specify a Heat API URL "
- "via either --heat-url or "
- "env[HEAT_URL]")
+ if args.os_no_client_auth:
+ if not args.heat_url:
+ raise exc.CommandError("If you specify --os-no-client-auth"
+ " you must also specify a Heat API URL"
+ " via either --heat-url or"
+ " env[HEAT_URL]")
+ else:
+ # Tenant name or ID is needed to make keystoneclient retrieve a
+ # service catalog, it's not required if os_no_client_auth is
+ # specified, neither is the auth URL
+ if not (args.os_tenant_id or args.os_tenant_name):
+ raise exc.CommandError("You must provide a tenant_id via"
+ " either --os-tenant-id or via"
+ " env[OS_TENANT_ID]")
+
+ if not args.os_auth_url:
+ raise exc.CommandError("You must provide an auth url via"
+ " either --os-auth-url or via"
+ " env[OS_AUTH_URL]")
+
kwargs = {
'username': args.os_username,
'password': args.os_password,