Add project_id and project_name options

Use tenant_id/project_id and tenant_name/project_name for authorization.
Note tenant_xxx parameters are preferred if both are set.

Change-Id: Ie1d51dd6ea2237110b412ee7ca8f6db3b471a486
This commit is contained in:
Jeremy Liu 2017-02-03 16:34:49 +08:00
parent 91baab7f7a
commit 98604f29c4

View File

@ -268,6 +268,16 @@ class MistralShell(app.App):
' or OS_PROJECT_ID)'
)
parser.add_argument(
'--os-project-id',
action='store',
dest='project_id',
default=env('OS_TENANT_ID', 'OS_PROJECT_ID'),
help='Authentication project identifier (Env: OS_TENANT_ID'
' or OS_PROJECT_ID), will use tenant_id if both tenant_id'
' and project_id are set'
)
parser.add_argument(
'--os-tenant-name',
action='store',
@ -278,6 +288,17 @@ class MistralShell(app.App):
' or OS_PROJECT_NAME)'
)
parser.add_argument(
'--os-project-name',
action='store',
dest='project_name',
default=env('OS_TENANT_NAME', 'OS_PROJECT_NAME',
default='Default'),
help='Authentication project name (Env: OS_TENANT_NAME'
' or OS_PROJECT_NAME), will use tenant_name if both'
' tenant_name and project_name are set'
)
parser.add_argument(
'--os-auth-token',
action='store',
@ -538,9 +559,9 @@ class MistralShell(app.App):
mistral_url=self.options.mistral_url,
username=self.options.username,
api_key=self.options.password,
project_name=self.options.tenant_name,
project_name=self.options.tenant_name or self.options.project_name,
auth_url=self.options.auth_url,
project_id=self.options.tenant_id,
project_id=self.options.tenant_id or self.options.project_id,
endpoint_type=self.options.endpoint_type,
service_type=self.options.service_type,
auth_token=self.options.token,