Merge "Fixes Keystone v3 401 authentication failures"

This commit is contained in:
Jenkins 2017-03-08 15:47:39 +00:00 committed by Gerrit Code Review
commit 50ac27de70
3 changed files with 36 additions and 24 deletions

View File

@ -127,6 +127,8 @@ class BaseAuthPlugin(object):
"tenant_name",
"token",
"auth_url",
"project_domain_name",
"user_domain_name",
]
def __init__(self, auth_system=None, **kwargs):

View File

@ -33,6 +33,13 @@ from oslo_utils import encodeutils
from oslo_utils import strutils
import six
from cloudpulseclient.openstack.common.apiclient import auth
from cloudpulseclient.openstack.common.apiclient import exceptions as exc
from cloudpulseclient.openstack.common import cliutils
from cloudpulseclient.v1 import client
from cloudpulseclient.v1 import shell as shell_v1
from cloudpulseclient import version
HAS_KEYRING = False
all_errors = ValueError
try:
@ -49,13 +56,6 @@ try:
except ImportError:
pass
from cloudpulseclient.openstack.common.apiclient import auth
from cloudpulseclient.openstack.common.apiclient import exceptions as exc
from cloudpulseclient.openstack.common import cliutils
from cloudpulseclient.v1 import client
from cloudpulseclient.v1 import shell as shell_v1
from cloudpulseclient import version
DEFAULT_API_VERSION = '1'
DEFAULT_ENDPOINT_TYPE = 'publicURL'
DEFAULT_SERVICE_TYPE = 'health'
@ -521,13 +521,16 @@ class OpenStackCloudPulseShell(object):
'--os-password, env[OS_PASSWORD], or '
'prompted response')
self.cs = client.Client(username=os_username,
self.cs = client.Client(
username=os_username,
api_key=os_password,
project_id=os_tenant_id,
project_name=os_tenant_name,
auth_url=os_auth_url,
service_type=service_type,
region_name=args.os_region_name,
project_domain_name=args.os_project_domain_name,
user_domain_name=args.os_user_domain_name,
cacert=cacert,
insecure=insecure,
cloudpulse_url=bypass_url)

View File

@ -25,16 +25,20 @@ class Client(object):
def __init__(self, username=None, api_key=None, project_id=None,
project_name=None, auth_url=None, cloudpulse_url=None,
endpoint_type='publicURL', service_type='container',
project_domain_name=None, user_domain_name=None,
region_name=None, input_auth_token=None, insecure=False,
cacert=None):
keystone = None
if not input_auth_token:
keystone = self.get_keystone_client(username=username,
keystone = self.get_keystone_client(
username=username,
api_key=api_key,
auth_url=auth_url,
project_id=project_id,
project_name=project_name,
project_domain_name=project_domain_name,
user_domain_name=user_domain_name,
insecure=insecure,
cacert=cacert)
@ -80,6 +84,7 @@ class Client(object):
@staticmethod
def get_keystone_client(username=None, api_key=None, auth_url=None,
insecure=False, cacert=None, token=None,
project_domain_name=None, user_domain_name=None,
project_id=None, project_name=None):
if not auth_url:
raise RuntimeError("No auth url specified")
@ -94,6 +99,8 @@ class Client(object):
cacert=cacert,
tenant_id=project_id,
tenant_name=project_name,
project_domain_name=project_domain_name,
user_domain_name=user_domain_name,
auth_url=auth_url,
endpoint=auth_url)
client.authenticate()