Allow to use the none auth plugin
This change allows to use the none auth plugin in CLI without having to specify --os-cloud file with basically a single endpoint parameter. Closes-Bug: #1724283 Depends-On: I3e477895ba0c989ffd0c91c45791e9f74173a3d6 Depends-On: I3de32193f41d9d1012043b43ae8080f3b1e828e5 Change-Id: I6cf4e22d676f4a55f84863125aee7318915a7404
This commit is contained in:
parent
22de9c2bbf
commit
b764efc46f
|
@ -247,7 +247,8 @@ class ClientManager(object):
|
|||
@property
|
||||
def auth_ref(self):
|
||||
"""Dereference will trigger an auth if it hasn't already"""
|
||||
if not self._auth_required:
|
||||
if (not self._auth_required or
|
||||
self._cli_options.config['auth_type'] == 'none'):
|
||||
# Forcibly skip auth if we know we do not need it
|
||||
return None
|
||||
if not self._auth_ref:
|
||||
|
|
|
@ -21,6 +21,7 @@ from keystoneauth1 import exceptions as ksa_exceptions
|
|||
from keystoneauth1.identity import generic as generic_plugin
|
||||
from keystoneauth1.identity.v3 import k2k
|
||||
from keystoneauth1 import loading
|
||||
from keystoneauth1 import noauth
|
||||
from keystoneauth1 import token_endpoint
|
||||
|
||||
try:
|
||||
|
@ -81,6 +82,29 @@ class TestClientCache(utils.TestCase):
|
|||
|
||||
class TestClientManager(utils.TestClientManager):
|
||||
|
||||
def test_client_manager_none(self):
|
||||
none_auth = {
|
||||
'endpoint': fakes.AUTH_URL,
|
||||
}
|
||||
client_manager = self._make_clientmanager(
|
||||
auth_args=none_auth,
|
||||
auth_plugin_name='none',
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
fakes.AUTH_URL,
|
||||
client_manager._cli_options.config['auth']['endpoint'],
|
||||
)
|
||||
self.assertIsInstance(
|
||||
client_manager.auth,
|
||||
noauth.NoAuth,
|
||||
)
|
||||
# Check that the endpoint option works as the override
|
||||
self.assertEqual(
|
||||
fakes.AUTH_URL,
|
||||
client_manager.get_endpoint_for_service_type('baremetal'),
|
||||
)
|
||||
|
||||
def test_client_manager_admin_token(self):
|
||||
token_auth = {
|
||||
'endpoint': fakes.AUTH_URL,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
It is now possible to specify the ``none`` auth type (via ``--os-auth-type`` CLI argument or
|
||||
``OS_AUTH_TYPE`` environment variable). To use it, ``--os-endpoint`` CLI argument or
|
||||
``OS_ENDPOINT`` environment variable must be specified. See `the bug
|
||||
<https://bugs.launchpad.net/python-openstackclient/+bug/1724283>`_ for more detail.
|
Loading…
Reference in New Issue