Merge "Use consistent env variable naming"

This commit is contained in:
Jenkins 2016-07-21 14:38:34 +00:00 committed by Gerrit Code Review
commit 59c689d4e4
3 changed files with 30 additions and 8 deletions

View File

@ -268,10 +268,11 @@ class OpenStackManilaShell(object):
parser.add_argument('--bypass-url',
metavar='<bypass-url>',
default=cliutils.env('MANILACLIENT_BYPASS_URL'),
default=cliutils.env('OS_MANILA_BYPASS_URL',
'MANILACLIENT_BYPASS_URL'),
help=("Use this API endpoint instead of the "
"Service Catalog. Defaults to "
"env[MANILACLIENT_BYPASS_URL]."))
"env[OS_MANILA_BYPASS_URL]."))
parser.add_argument('--bypass_url',
help=argparse.SUPPRESS)
@ -283,24 +284,29 @@ class OpenStackManilaShell(object):
parser.add_argument('--service-name',
metavar='<service-name>',
default=cliutils.env('MANILA_SERVICE_NAME'),
help='Defaults to env[MANILA_SERVICE_NAME].')
default=cliutils.env('OS_MANILA_SERVICE_NAME',
'MANILA_SERVICE_NAME'),
help='Defaults to env[OS_MANILA_SERVICE_NAME].')
parser.add_argument('--service_name',
help=argparse.SUPPRESS)
parser.add_argument('--share-service-name',
metavar='<share-service-name>',
default=cliutils.env('MANILA_share_service_name'),
help='Defaults to env[MANILA_share_service_name].')
default=cliutils.env(
'OS_MANILA_SHARE_SERVICE_NAME',
'MANILA_share_service_name'),
help='Defaults to env'
'[OS_MANILA_SHARE_SERVICE_NAME].')
parser.add_argument('--share_service_name',
help=argparse.SUPPRESS)
parser.add_argument('--endpoint-type',
metavar='<endpoint-type>',
default=cliutils.env(
'OS_MANILA_ENDPOINT_TYPE',
'MANILA_ENDPOINT_TYPE',
default=DEFAULT_MANILA_ENDPOINT_TYPE),
help='Defaults to env[MANILA_ENDPOINT_TYPE] or '
help='Defaults to env[OS_MANILA_ENDPOINT_TYPE] or '
+ DEFAULT_MANILA_ENDPOINT_TYPE + '.')
parser.add_argument('--endpoint_type',
help=argparse.SUPPRESS)

View File

@ -135,12 +135,17 @@ class OpenstackManilaShellTest(utils.TestCase):
)
@ddt.data(
{"env_vars": {"MANILACLIENT_BYPASS_URL": "http://foo.url",
{"env_vars": {"OS_MANILA_BYPASS_URL": "http://foo.url",
"OS_TOKEN": "foo_token"},
"kwargs": {"--os-token": "bar_token",
"--bypass-url": "http://bar.url"},
"expected": {"input_auth_token": "bar_token",
"service_catalog_url": "http://bar.url"}},
{"env_vars": {"OS_MANILA_BYPASS_URL": "http://foo.url",
"OS_TOKEN": "foo_token"},
"kwargs": {},
"expected": {"input_auth_token": "foo_token",
"service_catalog_url": "http://foo.url"}},
{"env_vars": {},
"kwargs": {"--os-token": "bar_token",
"--bypass-url": "http://bar.url"},
@ -155,6 +160,12 @@ class OpenstackManilaShellTest(utils.TestCase):
"kwargs": {"--bypass-url": "http://bar.url"},
"expected": {"input_auth_token": "foo_token",
"service_catalog_url": "http://bar.url"}},
{"env_vars": {"MANILACLIENT_BYPASS_URL": "http://foo.url",
"OS_MANILA_BYPASS_URL": "http://bar.url",
"OS_TOKEN": "foo_token"},
"kwargs": {"--os-token": "bar_token"},
"expected": {"input_auth_token": "bar_token",
"service_catalog_url": "http://bar.url"}},
)
@ddt.unpack
def test_main_success_with_token(self, env_vars, kwargs, expected):

View File

@ -0,0 +1,5 @@
---
fixes:
- Use consistent environment variable naming. All old
variables are still supported due to compatibility reasons.