shell: do not force domain to be present

If OS_PROJECT_NAME and Keystone v2 is used there's no need to set a domain.

Change-Id: I9555b571224262b61255f70a30f540a32b8ae2fc
This commit is contained in:
Julien Danjou 2017-01-25 19:03:49 +01:00
parent 658d7e27ff
commit 536ebe2054

View File

@ -181,15 +181,6 @@ class CeilometerShell(object):
# Return parsed args
return api_version, subcommand_parser.parse_args(argv)
@staticmethod
def no_project_and_domain_set(args):
if not (args.os_project_id or (args.os_project_name and
(args.os_user_domain_name or args.os_user_domain_id)) or
(args.os_tenant_id or args.os_tenant_name)):
return True
else:
return False
def main(self, argv):
parsed = self.parse_args(argv)
if parsed == 0:
@ -217,17 +208,12 @@ class CeilometerShell(object):
"either --os-password or via "
"env[OS_PASSWORD]")
if self.no_project_and_domain_set(args):
if not (args.os_project_id or args.os_project_name
or args.os_tenant_id or args.os_tenant_name):
# steer users towards Keystone V3 API
raise exc.CommandError("You must provide a project_id via "
"either --os-project-id or via "
"env[OS_PROJECT_ID] and "
"a domain_name via either "
"--os-user-domain-name or via "
"env[OS_USER_DOMAIN_NAME] or "
"a domain_id via either "
"--os-user-domain-id or via "
"env[OS_USER_DOMAIN_ID]")
raise exc.CommandError("You must provide a project_id "
"(or name) via either --os-project-id "
"or via env[OS_PROJECT_ID]")
if not self.auth_plugin.opts['auth_url']:
raise exc.CommandError("You must provide an auth url via "