Merge "Do not require OpenStack authentication to run osprofiler CLI"
This commit is contained in:
commit
63acc8dbb9
|
@ -37,31 +37,6 @@ class OSProfilerShell(object):
|
|||
args = self._get_base_parser().parse_args(argv)
|
||||
opts.set_defaults(cfg.CONF)
|
||||
|
||||
if not (args.os_auth_token and args.ceilometer_url):
|
||||
if not args.os_username:
|
||||
raise exc.CommandError(
|
||||
"You must provide a username via either --os-username or "
|
||||
"via env[OS_USERNAME]")
|
||||
|
||||
if not args.os_password:
|
||||
raise exc.CommandError(
|
||||
"You must provide a password via either --os-password or "
|
||||
"via env[OS_PASSWORD]")
|
||||
|
||||
if self._no_project_and_domain_set(args):
|
||||
# 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]")
|
||||
|
||||
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]")
|
||||
|
||||
args.func(args)
|
||||
|
||||
def _get_base_parser(self):
|
||||
|
|
|
@ -92,39 +92,6 @@ class ShellTestCase(test.TestCase):
|
|||
"Expected: `osprofiler.exc.CommandError` is raised with "
|
||||
"message: '%s'." % expected_message)
|
||||
|
||||
def test_username_is_not_presented(self):
|
||||
os.environ.pop("OS_USERNAME")
|
||||
msg = ("You must provide a username via either --os-username or "
|
||||
"via env[OS_USERNAME]")
|
||||
self._test_with_command_error(self._trace_show_cmd(), msg)
|
||||
|
||||
def test_password_is_not_presented(self):
|
||||
os.environ.pop("OS_PASSWORD")
|
||||
msg = ("You must provide a password via either --os-password or "
|
||||
"via env[OS_PASSWORD]")
|
||||
self._test_with_command_error(self._trace_show_cmd(), msg)
|
||||
|
||||
def test_auth_url(self):
|
||||
os.environ.pop("OS_AUTH_URL")
|
||||
msg = ("You must provide an auth url via either --os-auth-url or "
|
||||
"via env[OS_AUTH_URL]")
|
||||
self._test_with_command_error(self._trace_show_cmd(), msg)
|
||||
|
||||
def test_no_project_and_domain_set(self):
|
||||
os.environ.pop("OS_PROJECT_ID")
|
||||
os.environ.pop("OS_PROJECT_NAME")
|
||||
os.environ.pop("OS_TENANT_ID")
|
||||
os.environ.pop("OS_TENANT_NAME")
|
||||
os.environ.pop("OS_USER_DOMAIN_ID")
|
||||
os.environ.pop("OS_USER_DOMAIN_NAME")
|
||||
|
||||
msg = ("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]")
|
||||
self._test_with_command_error(self._trace_show_cmd(), msg)
|
||||
|
||||
def test_trace_show_ceilometerclient_is_missed(self):
|
||||
sys.modules["ceilometerclient"] = None
|
||||
sys.modules["ceilometerclient.client"] = None
|
||||
|
|
Loading…
Reference in New Issue