noauth: fix endpoint envvar

The name of the option in the noauth authentication plugin is
gnocchi-endpoint which means the env var taken is
GNOCCHI_GNOCCHI_ENDPOINT – quite confusing.

Let's use endpoint (GNOCCHI_ENDPOINT and --endpoint) everywhere.

Change-Id: Icbc7234a9479fdf1ca98ac78efceff44acfbf379
This commit is contained in:
Julien Danjou 2015-10-06 14:34:23 +02:00
parent d114f98f0c
commit cdd7d07614
4 changed files with 20 additions and 14 deletions

View File

@ -37,7 +37,7 @@ For example, in Bash you would use::
The command line tool will attempt to reauthenticate using your provided credentials
for every request. You can override this behavior by manually supplying an auth
token using :option:`--gnocchi-endpoint` and :option:`--os-auth-token`. You can alternatively
token using :option:`--endpoint` and :option:`--os-auth-token`. You can alternatively
set these environment variables::
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041
@ -45,8 +45,9 @@ set these environment variables::
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
Also, if the server doesn't support authentication, you can provide
:option:`--os-auth-plugin` gnocchi-noauth, :option:`--gnocchi-endpoint`, :option:`--user-id`
and :option:`--project-id`. You can alternatively set these environment variables::
:option:`--os-auth-plugin` gnocchi-noauth, :option:`--endpoint`,
:option:`--user-id` and :option:`--project-id`. You can alternatively set these
environment variables::
export OS_AUTH_PLUGIN=gnocchi-noauth
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041

View File

@ -69,10 +69,17 @@ class GnocchiNoAuthLoader(loading.BaseLoader):
def get_options(self):
options = super(GnocchiNoAuthLoader, self).get_options()
options.extend([
GnocchiOpt('user-id', help='User ID', required=True),
GnocchiOpt('project-id', help='Project ID', required=True),
GnocchiOpt('roles', help='Roles', default="admin"),
GnocchiOpt('gnocchi-endpoint', help='Gnocchi endpoint',
dest="endpoint", required=True),
GnocchiOpt('user-id', help='User ID', required=True,
metavar="<gnocchi user id>"),
GnocchiOpt('project-id', help='Project ID', required=True,
metavar="<gnocchi project id>"),
GnocchiOpt('roles', help='Roles', default="admin",
metavar="<gnocchi roles>"),
GnocchiOpt('endpoint', help='Gnocchi endpoint',
deprecated=[
GnocchiOpt('gnocchi-endpoint'),
],
dest="endpoint", required=True,
metavar="<gnocchi endpoint>"),
])
return options

View File

@ -123,9 +123,7 @@ class GnocchiShell(app.App):
if not isinstance(plugin, noauth.GnocchiNoAuthLoader):
parser.add_argument(
'--gnocchi-endpoint',
metavar='<endpoint>',
dest='endpoint',
'--endpoint',
default=os.environ.get('GNOCCHI_ENDPOINT'),
help='Gnocchi endpoint (Env: GNOCCHI_ENDPOINT)')

View File

@ -37,9 +37,9 @@ class GnocchiClient(object):
fail_ok=False, merge_stderr=False):
creds = ("--os-auth-plugin gnocchi-noauth "
"--user-id %s --project-id %s "
"--gnocchi-endpoint %s") % (self.user_id,
self.project_id,
self.endpoint)
"--endpoint %s") % (self.user_id,
self.project_id,
self.endpoint)
flags = creds + ' ' + flags