Default to using public interface for all clients

Within osc_lib, we currently set the default interface (for
OS_INTERFACE/--os-interface) to None.  This results in using the
defaults from each client.  In nearly all clients, the default is
to use the 'public' interface.  In keystoneclient, the default is
'admin'.  This means that end users using a CLI like 'openstack'
will need to have access to the admin endpoint to perform any
operation against the identity API unless they specify --os-interface
to explicitly use the public interface themselves.  This does not
provide a nice usability experience.

This patch changes the default interface to 'public' to enforce a
consistent experience across all clients with regards to the interface
that is used.  The default can still be overridden via the existing
--os-interface/OS_INTERFACE methods.

Change-Id: I4562a6a4bf5318d05ed9ccc347694d730125e4cc
This commit is contained in:
Nathan Kinder 2018-11-30 11:26:53 -08:00
parent af96eca279
commit c500b63703
1 changed files with 5 additions and 5 deletions

View File

@ -44,6 +44,7 @@ osprofiler_profiler = importutils.try_import("osprofiler.profiler")
DEFAULT_DOMAIN = 'default'
DEFAULT_INTERFACE = 'public'
def prompt_for_password(prompt=None):
@ -255,10 +256,12 @@ class OpenStackShell(app.App):
metavar='<interface>',
dest='interface',
choices=['admin', 'public', 'internal'],
default=utils.env('OS_INTERFACE'),
default=utils.env(
'OS_INTERFACE',
default=DEFAULT_INTERFACE),
help=_('Select an interface type.'
' Valid interface types: [admin, public, internal].'
' (Env: OS_INTERFACE)'),
' default=%s, (Env: OS_INTERFACE)') % DEFAULT_INTERFACE,
)
parser.add_argument(
'--os-service-provider',
@ -403,13 +406,10 @@ class OpenStackShell(app.App):
self._final_defaults()
# Do configuration file handling
# Ignore the default value of interface. Only if it is set later
# will it be used.
try:
self.cloud_config = cloud_config.OSC_Config(
pw_func=prompt_for_password,
override_defaults={
'interface': None,
'auth_type': self._auth_type,
},
)