Change the enduser facing apects of the shell

Change all references to the project name in the help text to
'sahara', including any command options. Also change environment
variable refereces to 'SAHARA_XXX'.  Modify the corresponding tests.

Partial-implements: blueprint savanna-renaming-client
Change-Id: If29996a51c9e8d1c26b5e7050ffee58b135b829e
This commit is contained in:
Trevor McKay 2014-03-11 12:16:48 -04:00
parent 8ef5137329
commit 38882f7198
3 changed files with 27 additions and 27 deletions

View File

@ -541,7 +541,7 @@ def do_job_binary_data_list(cs, args):
type=argparse.FileType('r'), type=argparse.FileType('r'),
help='Data to store.') help='Data to store.')
def do_job_binary_data_create(cs, args): def do_job_binary_data_create(cs, args):
"""Store data in Savanna's internal DB. """Store data in the internal DB.
Use 'swift upload' instead of this command. Use 'swift upload' instead of this command.
Use this command only if Swift is not available. Use this command only if Swift is not available.
""" """

View File

@ -19,7 +19,7 @@
### ###
""" """
Command-line interface to the OpenStack Savanna API. Command-line interface to the OpenStack Sahara API.
""" """
from __future__ import print_function from __future__ import print_function
@ -60,9 +60,9 @@ from savannaclient.openstack.common.apiclient import exceptions as exc
from savannaclient.openstack.common import cliutils from savannaclient.openstack.common import cliutils
from savannaclient.openstack.common import strutils from savannaclient.openstack.common import strutils
DEFAULT_SAVANNA_API_VERSION = 'api' DEFAULT_SAHARA_API_VERSION = 'api'
DEFAULT_ENDPOINT_TYPE = 'publicURL' DEFAULT_ENDPOINT_TYPE = 'publicURL'
DEFAULT_SAVANNA_SERVICE_TYPE = 'data_processing' DEFAULT_SAHARA_SERVICE_TYPE = 'data_processing'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -226,9 +226,9 @@ class OpenStackSavannaShell(object):
def get_base_parser(self): def get_base_parser(self):
parser = SavannaClientArgumentParser( parser = SavannaClientArgumentParser(
prog='savanna', prog='sahara',
description=__doc__.strip(), description=__doc__.strip(),
epilog='See "savanna help COMMAND" ' epilog='See "sahara help COMMAND" '
'for help on a specific command.', 'for help on a specific command.',
add_help=False, add_help=False,
formatter_class=OpenStackHelpFormatter, formatter_class=OpenStackHelpFormatter,
@ -272,7 +272,7 @@ class OpenStackSavannaShell(object):
parser.add_argument('--os-username', parser.add_argument('--os-username',
metavar='<auth-user-name>', metavar='<auth-user-name>',
default=cliutils.env('OS_USERNAME', default=cliutils.env('OS_USERNAME',
'SAVANNA_USERNAME'), 'SAHARA_USERNAME'),
help='Defaults to env[OS_USERNAME].') help='Defaults to env[OS_USERNAME].')
parser.add_argument('--os_username', parser.add_argument('--os_username',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
@ -280,7 +280,7 @@ class OpenStackSavannaShell(object):
parser.add_argument('--os-password', parser.add_argument('--os-password',
metavar='<auth-password>', metavar='<auth-password>',
default=cliutils.env('OS_PASSWORD', default=cliutils.env('OS_PASSWORD',
'SAVANNA_PASSWORD'), 'SAHARA_PASSWORD'),
help='Defaults to env[OS_PASSWORD].') help='Defaults to env[OS_PASSWORD].')
parser.add_argument('--os_password', parser.add_argument('--os_password',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
@ -288,7 +288,7 @@ class OpenStackSavannaShell(object):
parser.add_argument('--os-tenant-name', parser.add_argument('--os-tenant-name',
metavar='<auth-tenant-name>', metavar='<auth-tenant-name>',
default=cliutils.env('OS_TENANT_NAME', default=cliutils.env('OS_TENANT_NAME',
'SAVANNA_PROJECT_ID'), 'SAHARA_PROJECT_ID'),
help='Defaults to env[OS_TENANT_NAME].') help='Defaults to env[OS_TENANT_NAME].')
parser.add_argument('--os_tenant_name', parser.add_argument('--os_tenant_name',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
@ -300,7 +300,7 @@ class OpenStackSavannaShell(object):
parser.add_argument('--os-auth-url', parser.add_argument('--os-auth-url',
metavar='<auth-url>', metavar='<auth-url>',
default=cliutils.env('OS_AUTH_URL', 'SAVANNA_URL'), default=cliutils.env('OS_AUTH_URL', 'SAHARA_URL'),
help='Defaults to env[OS_AUTH_URL].') help='Defaults to env[OS_AUTH_URL].')
parser.add_argument('--os_auth_url', parser.add_argument('--os_auth_url',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
@ -346,9 +346,9 @@ class OpenStackSavannaShell(object):
parser.add_argument('--endpoint-type', parser.add_argument('--endpoint-type',
metavar='<endpoint-type>', metavar='<endpoint-type>',
default=cliutils.env( default=cliutils.env(
'SAVANNA_ENDPOINT_TYPE', 'SAHARA_ENDPOINT_TYPE',
default=DEFAULT_ENDPOINT_TYPE), default=DEFAULT_ENDPOINT_TYPE),
help='Defaults to env[SAVANNA_ENDPOINT_TYPE] or ' help='Defaults to env[SAHARA_ENDPOINT_TYPE] or '
+ DEFAULT_ENDPOINT_TYPE + '.') + DEFAULT_ENDPOINT_TYPE + '.')
# NOTE(dtroyer): We can't add --endpoint_type here due to argparse # NOTE(dtroyer): We can't add --endpoint_type here due to argparse
# thinking usage-list --end is ambiguous; but it # thinking usage-list --end is ambiguous; but it
@ -357,14 +357,14 @@ class OpenStackSavannaShell(object):
#parser.add_argument('--endpoint_type', #parser.add_argument('--endpoint_type',
# help=argparse.SUPPRESS) # help=argparse.SUPPRESS)
parser.add_argument('--savanna-api-version', parser.add_argument('--sahara-api-version',
metavar='<savanna-api-ver>', metavar='<sahara-api-ver>',
default=cliutils.env( default=cliutils.env(
'SAVANNA_API_VERSION', 'SAHARA_API_VERSION',
default=DEFAULT_SAVANNA_API_VERSION), default=DEFAULT_SAHARA_API_VERSION),
help='Accepts "api", ' help='Accepts "api", '
'defaults to env[SAVANNA_API_VERSION].') 'defaults to env[SAHARA_API_VERSION].')
parser.add_argument('--savanna_api_version', parser.add_argument('--sahara_api_version',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
parser.add_argument('--os-cacert', parser.add_argument('--os-cacert',
@ -521,7 +521,7 @@ class OpenStackSavannaShell(object):
# build available subcommands based on version # build available subcommands based on version
self.extensions = \ self.extensions = \
self._discover_extensions(options.savanna_api_version) self._discover_extensions(options.sahara_api_version)
self._run_extension_hooks('__pre_parse_args__') self._run_extension_hooks('__pre_parse_args__')
# NOTE(dtroyer): Hackery to handle --endpoint_type due to argparse # NOTE(dtroyer): Hackery to handle --endpoint_type due to argparse
@ -533,7 +533,7 @@ class OpenStackSavannaShell(object):
argv[spot] = '--endpoint-type' argv[spot] = '--endpoint-type'
subcommand_parser = \ subcommand_parser = \
self.get_subcommand_parser(options.savanna_api_version) self.get_subcommand_parser(options.sahara_api_version)
self.parser = subcommand_parser self.parser = subcommand_parser
if options.help or not argv: if options.help or not argv:
@ -586,7 +586,7 @@ class OpenStackSavannaShell(object):
endpoint_type = DEFAULT_ENDPOINT_TYPE endpoint_type = DEFAULT_ENDPOINT_TYPE
if not service_type: if not service_type:
service_type = DEFAULT_SAVANNA_SERVICE_TYPE service_type = DEFAULT_SAHARA_SERVICE_TYPE
# NA for Savanna - there is only one service this CLI accesses # NA for Savanna - there is only one service this CLI accesses
# service_type = utils.get_service_type(args.func) or service_type # service_type = utils.get_service_type(args.func) or service_type
@ -715,7 +715,7 @@ class OpenStackSavannaShell(object):
def do_bash_completion(self, _args): def do_bash_completion(self, _args):
"""Prints all of the commands and options to stdout so that the """Prints all of the commands and options to stdout so that the
savanna.bash_completion script doesn't have to hard code them. sahara.bash_completion script doesn't have to hard code them.
""" """
commands = set() commands = set()
options = set() options = set()

View File

@ -119,9 +119,9 @@ class ShellTest(utils.TestCase):
def test_help(self): def test_help(self):
required = [ required = [
'.*?^usage: savanna', '.*?^usage: sahara',
'.*?^\s+plugin-list\s+Print a list of available plugins.', '.*?^\s+plugin-list\s+Print a list of available plugins.',
'.*?^See "savanna help COMMAND" for help on a specific command', '.*?^See "sahara help COMMAND" for help on a specific command',
] ]
stdout, stderr = self.shell('help') stdout, stderr = self.shell('help')
for r in required: for r in required:
@ -130,7 +130,7 @@ class ShellTest(utils.TestCase):
def test_help_on_subcommand(self): def test_help_on_subcommand(self):
required = [ required = [
'.*?^usage: savanna plugin-list', '.*?^usage: sahara plugin-list',
'.*?^Print a list of available plugins.', '.*?^Print a list of available plugins.',
] ]
stdout, stderr = self.shell('help plugin-list') stdout, stderr = self.shell('help plugin-list')
@ -140,9 +140,9 @@ class ShellTest(utils.TestCase):
def test_help_no_options(self): def test_help_no_options(self):
required = [ required = [
'.*?^usage: savanna', '.*?^usage: sahara',
'.*?^\s+plugin-list\s+Print a list of available plugins.', '.*?^\s+plugin-list\s+Print a list of available plugins.',
'.*?^See "savanna help COMMAND" for help on a specific command', '.*?^See "sahara help COMMAND" for help on a specific command',
] ]
stdout, stderr = self.shell('') stdout, stderr = self.shell('')
for r in required: for r in required: