shell: make client works with default Gnocchi installation

This sets the default auth mode to "basic" (like Gnocchi itself) and the
default value for user and endpoint to something that make it work without
setting anything in simple scenario.

Basically, it makes it work by default in many simple cases.

Change-Id: I7f2dab85f97808f5245d80fd8e04cc535d1f3f6f
This commit is contained in:
Julien Danjou 2017-01-26 15:37:26 +01:00
parent 1ef64d5fd5
commit 45e59efaa8
2 changed files with 3 additions and 1 deletions

View File

@ -107,9 +107,11 @@ class GnocchiBasicLoader(loading.BaseLoader):
options = super(GnocchiBasicLoader, self).get_options()
options.extend([
GnocchiOpt('user', help='User', required=True,
default="admin",
metavar="<gnocchi user>"),
GnocchiOpt('endpoint', help='Gnocchi endpoint',
dest="endpoint", required=True,
default="http://localhost:8041",
metavar="<gnocchi endpoint>"),
])
return options

View File

@ -132,7 +132,7 @@ class GnocchiShell(app.App):
help='Defaults to env[GNOCCHI_API_VERSION] or 1.')
loading.register_session_argparse_arguments(parser=parser)
plugin = loading.register_auth_argparse_arguments(
parser=parser, argv=sys.argv, default="password")
parser=parser, argv=sys.argv, default="gnocchi-basic")
if not isinstance(plugin, (auth.GnocchiNoAuthLoader,
auth.GnocchiBasicLoader)):