Pegleg Shipyard Auth Token instead of user/pass
Recently Shipyard was updated in [0] to allow a user to provide an auth token manually, as an environment variable, instead of having Shipyard obtain a token from Keystone using passed in auth variables including a username and password. This patch expands on that functionality to allow a user to either set an OS_AUTH_TOKEN environment variable, or pass it during the upload command with the --os-auth-token flag. If it is present, only the token is used and the other auth variables are ignored. [0] https://review.opendev.org/#/c/666402/ Change-Id: Iaf2a109022e8f5d496851ff43fcfa8198b5411c9
This commit is contained in:
parent
c4720353d9
commit
e79672987e
|
@ -339,6 +339,7 @@ def collection_default_callback(ctx, param, value):
|
|||
@click.option('--os-username', envvar='OS_USERNAME', required=False)
|
||||
@click.option('--os-password', envvar='OS_PASSWORD', required=False)
|
||||
@click.option('--os-auth-url', envvar='OS_AUTH_URL', required=False)
|
||||
@click.option('--os-auth-token', envvar='OS_AUTH_TOKEN', required=False)
|
||||
# Option passed to Shipyard client context
|
||||
@click.option(
|
||||
'--context-marker',
|
||||
|
@ -370,11 +371,15 @@ def collection_default_callback(ctx, param, value):
|
|||
@click.pass_context
|
||||
def upload(ctx, *, os_project_domain_name, os_user_domain_name,
|
||||
os_project_name, os_username, os_password, os_auth_url,
|
||||
context_marker, site_name, buffer_mode, collection):
|
||||
os_auth_token, context_marker, site_name, buffer_mode, collection):
|
||||
if not ctx.obj:
|
||||
ctx.obj = {}
|
||||
|
||||
# Build API parameters required by Shipyard API Client.
|
||||
if os_auth_token:
|
||||
os.environ['OS_AUTH_TOKEN'] = os_auth_token
|
||||
auth_vars = {'os_auth_token': os_auth_token}
|
||||
else:
|
||||
auth_vars = {
|
||||
'project_domain_name': os_project_domain_name,
|
||||
'user_domain_name': os_user_domain_name,
|
||||
|
|
Loading…
Reference in New Issue