Merge "Mark help messages for Translation"

This commit is contained in:
Jenkins 2017-01-23 17:16:33 +00:00 committed by Gerrit Code Review
commit 34cd785838
6 changed files with 183 additions and 176 deletions

View File

@ -51,6 +51,7 @@ except ImportError:
from magnumclient.common import cliutils from magnumclient.common import cliutils
from magnumclient import exceptions as exc from magnumclient import exceptions as exc
from magnumclient.i18n import _
from magnumclient.v1 import client as client_v1 from magnumclient.v1 import client as client_v1
from magnumclient.v1 import shell as shell_v1 from magnumclient.v1 import shell as shell_v1
from magnumclient import version from magnumclient import version
@ -242,19 +243,20 @@ class OpenStackMagnumShell(object):
parser.add_argument('--debug', parser.add_argument('--debug',
default=False, default=False,
action='store_true', action='store_true',
help="Print debugging output.") help=_("Print debugging output."))
parser.add_argument('--os-cache', parser.add_argument('--os-cache',
default=strutils.bool_from_string( default=strutils.bool_from_string(
cliutils.env('OS_CACHE', default=False)), cliutils.env('OS_CACHE', default=False)),
action='store_true', action='store_true',
help="Use the auth token cache. Defaults to False " help=_("Use the auth token cache. Defaults to "
"if env[OS_CACHE] is not set.") "False if env[OS_CACHE] is not set."))
parser.add_argument('--os-region-name', parser.add_argument('--os-region-name',
metavar='<region-name>', metavar='<region-name>',
default=os.environ.get('OS_REGION_NAME'), default=os.environ.get('OS_REGION_NAME'),
help='Region name. Default=env[OS_REGION_NAME].') help=_('Region name. '
'Default=env[OS_REGION_NAME].'))
# TODO(mattf) - add get_timings support to Client # TODO(mattf) - add get_timings support to Client
@ -273,41 +275,41 @@ class OpenStackMagnumShell(object):
parser.add_argument('--os-auth-url', parser.add_argument('--os-auth-url',
metavar='<auth-auth-url>', metavar='<auth-auth-url>',
default=cliutils.env('OS_AUTH_URL', default=None), default=cliutils.env('OS_AUTH_URL', default=None),
help='Defaults to env[OS_AUTH_URL].') help=_('Defaults to env[OS_AUTH_URL].'))
parser.add_argument('--os-user-id', parser.add_argument('--os-user-id',
metavar='<auth-user-id>', metavar='<auth-user-id>',
default=cliutils.env('OS_USER_ID', default=None), default=cliutils.env('OS_USER_ID', default=None),
help='Defaults to env[OS_USER_ID].') help=_('Defaults to env[OS_USER_ID].'))
parser.add_argument('--os-username', parser.add_argument('--os-username',
metavar='<auth-username>', metavar='<auth-username>',
default=cliutils.env('OS_USERNAME', default=None), default=cliutils.env('OS_USERNAME', default=None),
help='Defaults to env[OS_USERNAME].') help=_('Defaults to env[OS_USERNAME].'))
parser.add_argument('--os-user-domain-id', parser.add_argument('--os-user-domain-id',
metavar='<auth-user-domain-id>', metavar='<auth-user-domain-id>',
default=cliutils.env('OS_USER_DOMAIN_ID', default=cliutils.env('OS_USER_DOMAIN_ID',
default=None), default=None),
help='Defaults to env[OS_USER_DOMAIN_ID].') help=_('Defaults to env[OS_USER_DOMAIN_ID].'))
parser.add_argument('--os-user-domain-name', parser.add_argument('--os-user-domain-name',
metavar='<auth-user-domain-name>', metavar='<auth-user-domain-name>',
default=cliutils.env('OS_USER_DOMAIN_NAME', default=cliutils.env('OS_USER_DOMAIN_NAME',
default=None), default=None),
help='Defaults to env[OS_USER_DOMAIN_NAME].') help=_('Defaults to env[OS_USER_DOMAIN_NAME].'))
parser.add_argument('--os-project-id', parser.add_argument('--os-project-id',
metavar='<auth-project-id>', metavar='<auth-project-id>',
default=cliutils.env('OS_PROJECT_ID', default=cliutils.env('OS_PROJECT_ID',
default=None), default=None),
help='Defaults to env[OS_PROJECT_ID].') help=_('Defaults to env[OS_PROJECT_ID].'))
parser.add_argument('--os-project-name', parser.add_argument('--os-project-name',
metavar='<auth-project-name>', metavar='<auth-project-name>',
default=cliutils.env('OS_PROJECT_NAME', default=cliutils.env('OS_PROJECT_NAME',
default=None), default=None),
help='Defaults to env[OS_PROJECT_NAME].') help=_('Defaults to env[OS_PROJECT_NAME].'))
parser.add_argument('--os-tenant-id', parser.add_argument('--os-tenant-id',
metavar='<auth-tenant-id>', metavar='<auth-tenant-id>',
@ -325,29 +327,30 @@ class OpenStackMagnumShell(object):
metavar='<auth-project-domain-id>', metavar='<auth-project-domain-id>',
default=cliutils.env('OS_PROJECT_DOMAIN_ID', default=cliutils.env('OS_PROJECT_DOMAIN_ID',
default=None), default=None),
help='Defaults to env[OS_PROJECT_DOMAIN_ID].') help=_('Defaults to env[OS_PROJECT_DOMAIN_ID].'))
parser.add_argument('--os-project-domain-name', parser.add_argument('--os-project-domain-name',
metavar='<auth-project-domain-name>', metavar='<auth-project-domain-name>',
default=cliutils.env('OS_PROJECT_DOMAIN_NAME', default=cliutils.env('OS_PROJECT_DOMAIN_NAME',
default=None), default=None),
help='Defaults to env[OS_PROJECT_DOMAIN_NAME].') help=_('Defaults to '
'env[OS_PROJECT_DOMAIN_NAME].'))
parser.add_argument('--os-token', parser.add_argument('--os-token',
metavar='<auth-token>', metavar='<auth-token>',
default=cliutils.env('OS_TOKEN', default=None), default=cliutils.env('OS_TOKEN', default=None),
help='Defaults to env[OS_TOKEN].') help=_('Defaults to env[OS_TOKEN].'))
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',
default=None), default=None),
help='Defaults to env[OS_PASSWORD].') help=_('Defaults to env[OS_PASSWORD].'))
parser.add_argument('--service-type', parser.add_argument('--service-type',
metavar='<service-type>', metavar='<service-type>',
help='Defaults to container-infra for all ' help=_('Defaults to container-infra for all '
'actions.') 'actions.'))
parser.add_argument('--service_type', parser.add_argument('--service_type',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
@ -361,7 +364,7 @@ class OpenStackMagnumShell(object):
metavar='<os-endpoint-type>', metavar='<os-endpoint-type>',
default=cliutils.env('OS_ENDPOINT_TYPE', default=cliutils.env('OS_ENDPOINT_TYPE',
default=None), default=None),
help='Defaults to env[OS_ENDPOINT_TYPE]') help=_('Defaults to env[OS_ENDPOINT_TYPE]'))
parser.add_argument('--os-interface', parser.add_argument('--os-interface',
metavar='<os-interface>', metavar='<os-interface>',
@ -373,7 +376,7 @@ class OpenStackMagnumShell(object):
parser.add_argument('--os-cloud', parser.add_argument('--os-cloud',
metavar='<auth-cloud>', metavar='<auth-cloud>',
default=cliutils.env('OS_CLOUD', default=None), default=cliutils.env('OS_CLOUD', default=None),
help='Defaults to env[OS_CLOUD].') help=_('Defaults to env[OS_CLOUD].'))
# 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
@ -387,24 +390,24 @@ class OpenStackMagnumShell(object):
default=cliutils.env( default=cliutils.env(
'MAGNUM_API_VERSION', 'MAGNUM_API_VERSION',
default='latest'), default='latest'),
help='Accepts "api", ' help=_('Accepts "api", '
'defaults to env[MAGNUM_API_VERSION].') 'defaults to env[MAGNUM_API_VERSION].'))
parser.add_argument('--magnum_api_version', parser.add_argument('--magnum_api_version',
help=argparse.SUPPRESS) help=argparse.SUPPRESS)
parser.add_argument('--os-cacert', parser.add_argument('--os-cacert',
metavar='<ca-certificate>', metavar='<ca-certificate>',
default=cliutils.env('OS_CACERT', default=None), default=cliutils.env('OS_CACERT', default=None),
help='Specify a CA bundle file to use in ' help=_('Specify a CA bundle file to use in '
'verifying a TLS (https) server certificate. ' 'verifying a TLS (https) server '
'Defaults to env[OS_CACERT].') 'certificate. Defaults to env[OS_CACERT].'))
parser.add_argument('--os-endpoint-override', parser.add_argument('--os-endpoint-override',
metavar='<endpoint-override>', metavar='<endpoint-override>',
default=cliutils.env('OS_ENDPOINT_OVERRIDE', default=cliutils.env('OS_ENDPOINT_OVERRIDE',
default=None), default=None),
help="Use this API endpoint instead of the " help=_("Use this API endpoint instead of the "
"Service Catalog.") "Service Catalog."))
parser.add_argument('--bypass-url', parser.add_argument('--bypass-url',
metavar='<bypass-url>', metavar='<bypass-url>',
default=cliutils.env('BYPASS_URL', default=None), default=cliutils.env('BYPASS_URL', default=None),
@ -417,7 +420,7 @@ class OpenStackMagnumShell(object):
default=cliutils.env('MAGNUMCLIENT_INSECURE', default=cliutils.env('MAGNUMCLIENT_INSECURE',
default=False), default=False),
action='store_true', action='store_true',
help="Do not verify https connections") help=_("Do not verify https connections"))
return parser return parser
@ -692,7 +695,7 @@ class OpenStackMagnumShell(object):
print(' '.join(commands | options)) print(' '.join(commands | options))
@cliutils.arg('command', metavar='<subcommand>', nargs='?', @cliutils.arg('command', metavar='<subcommand>', nargs='?',
help='Display help for <subcommand>.') help=_('Display help for <subcommand>.'))
def do_help(self, args): def do_help(self, args):
"""Display help about this program or one of its subcommands.""" """Display help about this program or one of its subcommands."""
# NOTE(jamespage): args.command is not guaranteed with python >= 3.4 # NOTE(jamespage): args.command is not guaranteed with python >= 3.4

View File

@ -29,99 +29,100 @@ def _show_baymodel(baymodel):
@utils.arg('--name', @utils.arg('--name',
metavar='<name>', metavar='<name>',
help='Name of the baymodel to create.') help=_('Name of the baymodel to create.'))
@utils.arg('--image-id', @utils.arg('--image-id',
required=True, required=True,
metavar='<image-id>', metavar='<image-id>',
help='The name or UUID of the base image to customize for the bay.') help=_('The name or UUID of the base image to customize for'
' the bay.'))
@utils.arg('--keypair-id', @utils.arg('--keypair-id',
required=True, required=True,
metavar='<keypair-id>', metavar='<keypair-id>',
help='The name or UUID of the SSH keypair to load into the' help=_('The name or UUID of the SSH keypair to load into the'
' Bay nodes.') ' Bay nodes.'))
@utils.arg('--external-network-id', @utils.arg('--external-network-id',
required=True, required=True,
metavar='<external-network-id>', metavar='<external-network-id>',
help='The external Neutron network ID to connect to this bay' help=_('The external Neutron network ID to connect to this bay'
' model.') ' model.'))
@utils.arg('--coe', @utils.arg('--coe',
required=True, required=True,
metavar='<coe>', metavar='<coe>',
help='Specify the Container Orchestration Engine to use.') help=_('Specify the Container Orchestration Engine to use.'))
@utils.arg('--fixed-network', @utils.arg('--fixed-network',
metavar='<fixed-network>', metavar='<fixed-network>',
help='The private Neutron network name to connect to this bay' help=_('The private Neutron network name to connect to this bay'
' model.') ' model.'))
@utils.arg('--fixed-subnet', @utils.arg('--fixed-subnet',
metavar='<fixed-subnet>', metavar='<fixed-subnet>',
help='The private Neutron subnet name to connect to bay.') help=_('The private Neutron subnet name to connect to bay.'))
@utils.arg('--network-driver', @utils.arg('--network-driver',
metavar='<network-driver>', metavar='<network-driver>',
help='The network driver name for instantiating container' help=_('The network driver name for instantiating container'
' networks.') ' networks.'))
@utils.arg('--volume-driver', @utils.arg('--volume-driver',
metavar='<volume-driver>', metavar='<volume-driver>',
help='The volume driver name for instantiating container' help=_('The volume driver name for instantiating container'
' volume.') ' volume.'))
@utils.arg('--dns-nameserver', @utils.arg('--dns-nameserver',
metavar='<dns-nameserver>', metavar='<dns-nameserver>',
default='8.8.8.8', default='8.8.8.8',
help='The DNS nameserver to use for this baymodel.') help=_('The DNS nameserver to use for this baymodel.'))
@utils.arg('--flavor-id', @utils.arg('--flavor-id',
metavar='<flavor-id>', metavar='<flavor-id>',
default='m1.medium', default='m1.medium',
help='The nova flavor id to use when launching the bay.') help=_('The nova flavor id to use when launching the bay.'))
@utils.arg('--master-flavor-id', @utils.arg('--master-flavor-id',
metavar='<master-flavor-id>', metavar='<master-flavor-id>',
help='The nova flavor id to use when launching the master node ' help=_('The nova flavor id to use when launching the master node '
'of the bay.') 'of the bay.'))
@utils.arg('--docker-volume-size', @utils.arg('--docker-volume-size',
metavar='<docker-volume-size>', metavar='<docker-volume-size>',
type=int, type=int,
help='Specify the number of size in GB ' help=_('Specify the number of size in GB '
'for the docker volume to use.') 'for the docker volume to use.'))
@utils.arg('--docker-storage-driver', @utils.arg('--docker-storage-driver',
metavar='<docker-storage-driver>', metavar='<docker-storage-driver>',
default='devicemapper', default='devicemapper',
help='Select a docker storage driver. Supported: devicemapper, ' help=_('Select a docker storage driver. Supported: devicemapper, '
'overlay. Default: devicemapper') 'overlay. Default: devicemapper'))
@utils.arg('--http-proxy', @utils.arg('--http-proxy',
metavar='<http-proxy>', metavar='<http-proxy>',
help='The http_proxy address to use for nodes in bay.') help=_('The http_proxy address to use for nodes in bay.'))
@utils.arg('--https-proxy', @utils.arg('--https-proxy',
metavar='<https-proxy>', metavar='<https-proxy>',
help='The https_proxy address to use for nodes in bay.') help=_('The https_proxy address to use for nodes in bay.'))
@utils.arg('--no-proxy', @utils.arg('--no-proxy',
metavar='<no-proxy>', metavar='<no-proxy>',
help='The no_proxy address to use for nodes in bay.') help=_('The no_proxy address to use for nodes in bay.'))
@utils.arg('--labels', metavar='<KEY1=VALUE1,KEY2=VALUE2;KEY3=VALUE3...>', @utils.arg('--labels', metavar='<KEY1=VALUE1,KEY2=VALUE2;KEY3=VALUE3...>',
action='append', default=[], action='append', default=[],
help='Arbitrary labels in the form of key=value pairs ' help=_('Arbitrary labels in the form of key=value pairs '
'to associate with a baymodel. ' 'to associate with a baymodel. '
'May be used multiple times.') 'May be used multiple times.'))
@utils.arg('--tls-disabled', @utils.arg('--tls-disabled',
action='store_true', default=False, action='store_true', default=False,
help='Disable TLS in the Bay.') help=_('Disable TLS in the Bay.'))
@utils.arg('--public', @utils.arg('--public',
action='store_true', default=False, action='store_true', default=False,
help='Make baymodel public.') help=_('Make baymodel public.'))
@utils.arg('--registry-enabled', @utils.arg('--registry-enabled',
action='store_true', default=False, action='store_true', default=False,
help='Enable docker registry in the Bay') help=_('Enable docker registry in the Bay'))
@utils.arg('--server-type', @utils.arg('--server-type',
metavar='<server-type>', metavar='<server-type>',
default='vm', default='vm',
help='Specify the server type to be used ' help=_('Specify the server type to be used '
'for example vm. For this release ' 'for example vm. For this release '
'default server type will be vm.') 'default server type will be vm.'))
@utils.arg('--master-lb-enabled', @utils.arg('--master-lb-enabled',
action='store_true', default=False, action='store_true', default=False,
help='Indicates whether created bays should have a load balancer ' help=_('Indicates whether created bays should have a load balancer '
'for master nodes or not.') 'for master nodes or not.'))
@utils.arg('--floating-ip-enabled', @utils.arg('--floating-ip-enabled',
action='store_true', default=True, action='store_true', default=True,
help='Indicates whether created bays should have a floating ip' help=_('Indicates whether created bays should have a floating ip'
'or not.') 'or not.'))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_baymodel_create(cs, args): def do_baymodel_create(cs, args):
"""Create a baymodel. """Create a baymodel.
@ -161,7 +162,7 @@ def do_baymodel_create(cs, args):
@utils.arg('baymodels', @utils.arg('baymodels',
metavar='<baymodels>', metavar='<baymodels>',
nargs='+', nargs='+',
help='ID or name of the (baymodel)s to delete.') help=_('ID or name of the (baymodel)s to delete.'))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_baymodel_delete(cs, args): def do_baymodel_delete(cs, args):
"""Delete specified baymodel. """Delete specified baymodel.
@ -180,7 +181,7 @@ def do_baymodel_delete(cs, args):
@utils.arg('baymodel', @utils.arg('baymodel',
metavar='<baymodel>', metavar='<baymodel>',
help='ID or name of the baymodel to show.') help=_('ID or name of the baymodel to show.'))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_baymodel_show(cs, args): def do_baymodel_show(cs, args):
"""Show details about the given baymodel. """Show details about the given baymodel.
@ -194,14 +195,14 @@ def do_baymodel_show(cs, args):
@utils.arg('--limit', @utils.arg('--limit',
metavar='<limit>', metavar='<limit>',
type=int, type=int,
help='Maximum number of baymodels to return') help=_('Maximum number of baymodels to return'))
@utils.arg('--sort-key', @utils.arg('--sort-key',
metavar='<sort-key>', metavar='<sort-key>',
help='Column to sort results by') help=_('Column to sort results by'))
@utils.arg('--sort-dir', @utils.arg('--sort-dir',
metavar='<sort-dir>', metavar='<sort-dir>',
choices=['desc', 'asc'], choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".') help=_('Direction to sort. "asc" or "desc".'))
@utils.arg('--fields', @utils.arg('--fields',
default=None, default=None,
metavar='<fields>', metavar='<fields>',
@ -228,20 +229,21 @@ def do_baymodel_list(cs, args):
sortby_index=None) sortby_index=None)
@utils.arg('baymodel', metavar='<baymodel>', help="UUID or name of baymodel") @utils.arg('baymodel', metavar='<baymodel>',
help=_("UUID or name of baymodel"))
@utils.arg( @utils.arg(
'op', 'op',
metavar='<op>', metavar='<op>',
choices=['add', 'replace', 'remove'], choices=['add', 'replace', 'remove'],
help="Operations: 'add', 'replace' or 'remove'") help=_("Operations: 'add', 'replace' or 'remove'"))
@utils.arg( @utils.arg(
'attributes', 'attributes',
metavar='<path=value>', metavar='<path=value>',
nargs='+', nargs='+',
action='append', action='append',
default=[], default=[],
help="Attributes to add/replace or remove " help=_("Attributes to add/replace or remove "
"(only PATH is necessary on remove)") "(only PATH is necessary on remove)"))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_baymodel_update(cs, args): def do_baymodel_update(cs, args):
"""Updates one or more baymodel attributes. """Updates one or more baymodel attributes.

View File

@ -39,19 +39,19 @@ def _show_bay(bay):
@utils.arg('--marker', @utils.arg('--marker',
metavar='<marker>', metavar='<marker>',
default=None, default=None,
help='The last bay UUID of the previous page; ' help=_('The last bay UUID of the previous page; '
'displays list of bays after "marker".') 'displays list of bays after "marker".'))
@utils.arg('--limit', @utils.arg('--limit',
metavar='<limit>', metavar='<limit>',
type=int, type=int,
help='Maximum number of bays to return.') help=_('Maximum number of bays to return.'))
@utils.arg('--sort-key', @utils.arg('--sort-key',
metavar='<sort-key>', metavar='<sort-key>',
help='Column to sort results by.') help=_('Column to sort results by.'))
@utils.arg('--sort-dir', @utils.arg('--sort-dir',
metavar='<sort-dir>', metavar='<sort-dir>',
choices=['desc', 'asc'], choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".') help=_('Direction to sort. "asc" or "desc".'))
@utils.arg('--fields', @utils.arg('--fields',
default=None, default=None,
metavar='<fields>', metavar='<fields>',
@ -81,30 +81,30 @@ def do_bay_list(cs, args):
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
@utils.arg('--name', @utils.arg('--name',
metavar='<name>', metavar='<name>',
help='Name of the bay to create.') help=_('Name of the bay to create.'))
@utils.arg('--baymodel', @utils.arg('--baymodel',
required=True, required=True,
metavar='<baymodel>', metavar='<baymodel>',
help='ID or name of the baymodel.') help=_('ID or name of the baymodel.'))
@utils.arg('--node-count', @utils.arg('--node-count',
metavar='<node-count>', metavar='<node-count>',
type=int, type=int,
default=1, default=1,
help='The bay node count.') help=_('The bay node count.'))
@utils.arg('--master-count', @utils.arg('--master-count',
metavar='<master-count>', metavar='<master-count>',
type=int, type=int,
default=1, default=1,
help='The number of master nodes for the bay.') help=_('The number of master nodes for the bay.'))
@utils.arg('--discovery-url', @utils.arg('--discovery-url',
metavar='<discovery-url>', metavar='<discovery-url>',
help='Specifies custom discovery url for node discovery.') help=_('Specifies custom discovery url for node discovery.'))
@utils.arg('--timeout', @utils.arg('--timeout',
metavar='<timeout>', metavar='<timeout>',
type=int, type=int,
default=60, default=60,
help='The timeout for bay creation in minutes. The default ' help=_('The timeout for bay creation in minutes. The default '
'is 60 minutes.') 'is 60 minutes.'))
def do_bay_create(cs, args): def do_bay_create(cs, args):
"""Create a bay. """Create a bay.
@ -135,7 +135,7 @@ def do_bay_create(cs, args):
@utils.arg('bay', @utils.arg('bay',
metavar='<bay>', metavar='<bay>',
nargs='+', nargs='+',
help='ID or name of the (bay)s to delete.') help=_('ID or name of the (bay)s to delete.'))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_bay_delete(cs, args): def do_bay_delete(cs, args):
"""Delete specified bay. """Delete specified bay.
@ -154,10 +154,10 @@ def do_bay_delete(cs, args):
@utils.arg('bay', @utils.arg('bay',
metavar='<bay>', metavar='<bay>',
help='ID or name of the bay to show.') help=_('ID or name of the bay to show.'))
@utils.arg('--long', @utils.arg('--long',
action='store_true', default=False, action='store_true', default=False,
help='Display extra associated Baymodel info.') help=_('Display extra associated Baymodel info.'))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_bay_show(cs, args): def do_bay_show(cs, args):
"""Show details about the given bay. """Show details about the given bay.
@ -175,23 +175,23 @@ def do_bay_show(cs, args):
_show_bay(bay) _show_bay(bay)
@utils.arg('bay', metavar='<bay>', help="UUID or name of bay") @utils.arg('bay', metavar='<bay>', help=_("UUID or name of bay"))
@utils.arg('--rollback', @utils.arg('--rollback',
action='store_true', default=False, action='store_true', default=False,
help='Rollback bay on update failure.') help=_('Rollback bay on update failure.'))
@utils.arg( @utils.arg(
'op', 'op',
metavar='<op>', metavar='<op>',
choices=['add', 'replace', 'remove'], choices=['add', 'replace', 'remove'],
help="Operations: 'add', 'replace' or 'remove'") help=_("Operations: 'add', 'replace' or 'remove'"))
@utils.arg( @utils.arg(
'attributes', 'attributes',
metavar='<path=value>', metavar='<path=value>',
nargs='+', nargs='+',
action='append', action='append',
default=[], default=[],
help="Attributes to add/replace or remove " help=_("Attributes to add/replace or remove "
"(only PATH is necessary on remove)") "(only PATH is necessary on remove)"))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_bay_update(cs, args): def do_bay_update(cs, args):
"""Update information about the given bay. """Update information about the given bay.
@ -213,14 +213,14 @@ def do_bay_update(cs, args):
@utils.arg('bay', @utils.arg('bay',
metavar='<bay>', metavar='<bay>',
help='ID or name of the bay to retrieve config.') help=_('ID or name of the bay to retrieve config.'))
@utils.arg('--dir', @utils.arg('--dir',
metavar='<dir>', metavar='<dir>',
default='.', default='.',
help='Directory to save the certificate and config files.') help=_('Directory to save the certificate and config files.'))
@utils.arg('--force', @utils.arg('--force',
action='store_true', default=False, action='store_true', default=False,
help='Overwrite files if existing.') help=_('Overwrite files if existing.'))
@utils.deprecated(DEPRECATION_MESSAGE) @utils.deprecated(DEPRECATION_MESSAGE)
def do_bay_config(cs, args): def do_bay_config(cs, args):
"""Configure native client to access bay. """Configure native client to access bay.

View File

@ -15,6 +15,7 @@
import os.path import os.path
from magnumclient.common import cliutils as utils from magnumclient.common import cliutils as utils
from magnumclient.i18n import _
DEPRECATION_MESSAGE = ( DEPRECATION_MESSAGE = (
@ -41,11 +42,11 @@ def _get_target_uuid(cs, args):
@utils.arg('--bay', @utils.arg('--bay',
required=False, required=False,
metavar='<bay>', metavar='<bay>',
help='ID or name of the bay.') help=_('ID or name of the bay.'))
@utils.arg('--cluster', @utils.arg('--cluster',
required=False, required=False,
metavar='<cluster>', metavar='<cluster>',
help='ID or name of the cluster.') help=_('ID or name of the cluster.'))
def do_ca_show(cs, args): def do_ca_show(cs, args):
"""Show details about the CA certificate for a bay or cluster.""" """Show details about the CA certificate for a bay or cluster."""
opts = { opts = {
@ -58,15 +59,16 @@ def do_ca_show(cs, args):
@utils.arg('--csr', @utils.arg('--csr',
metavar='<csr>', metavar='<csr>',
help='File path of the csr file to send to Magnum to get signed.') help=_('File path of the csr file to send to Magnum'
' to get signed.'))
@utils.arg('--bay', @utils.arg('--bay',
required=False, required=False,
metavar='<bay>', metavar='<bay>',
help='ID or name of the bay.') help=_('ID or name of the bay.'))
@utils.arg('--cluster', @utils.arg('--cluster',
required=False, required=False,
metavar='<cluster>', metavar='<cluster>',
help='ID or name of the cluster.') help=_('ID or name of the cluster.'))
def do_ca_sign(cs, args): def do_ca_sign(cs, args):
"""Generate the CA certificate for a bay or cluster.""" """Generate the CA certificate for a bay or cluster."""
opts = { opts = {

View File

@ -35,7 +35,7 @@ def _show_cluster_template(cluster_template):
@utils.deprecation_map(DEPRECATING_PARAMS) @utils.deprecation_map(DEPRECATING_PARAMS)
@utils.arg('--name', @utils.arg('--name',
metavar='<name>', metavar='<name>',
help='Name of the cluster template to create.') help=_('Name of the cluster template to create.'))
@utils.arg('--image-id', @utils.arg('--image-id',
dest='image', dest='image',
required=True, required=True,
@ -47,8 +47,8 @@ def _show_cluster_template(cluster_template):
dest='image', dest='image',
required=True, required=True,
metavar='<image>', metavar='<image>',
help='The name or UUID of the base image to customize for the ' help=_('The name or UUID of the base image to customize for the '
'Cluster.') 'Cluster.'))
@utils.arg('--keypair-id', @utils.arg('--keypair-id',
dest='keypair', dest='keypair',
metavar='<keypair>', metavar='<keypair>',
@ -58,8 +58,8 @@ def _show_cluster_template(cluster_template):
@utils.arg('--keypair', @utils.arg('--keypair',
dest='keypair', dest='keypair',
metavar='<keypair>', metavar='<keypair>',
help='The name or UUID of the SSH keypair to load into the Cluster ' help=_('The name or UUID of the SSH keypair to load into the '
'nodes.') 'Cluster nodes.'))
@utils.arg('--external-network-id', @utils.arg('--external-network-id',
dest='external_network', dest='external_network',
required=True, required=True,
@ -71,31 +71,31 @@ def _show_cluster_template(cluster_template):
dest='external_network', dest='external_network',
required=True, required=True,
metavar='<external-network>', metavar='<external-network>',
help='The external Neutron network name or UUID to connect to ' help=_('The external Neutron network name or UUID to connect to '
'this Cluster Template.') 'this Cluster Template.'))
@utils.arg('--coe', @utils.arg('--coe',
required=True, required=True,
metavar='<coe>', metavar='<coe>',
help='Specify the Container Orchestration Engine to use.') help=_('Specify the Container Orchestration Engine to use.'))
@utils.arg('--fixed-network', @utils.arg('--fixed-network',
metavar='<fixed-network>', metavar='<fixed-network>',
help='The private Neutron network name to connect to this Cluster' help=_('The private Neutron network name to connect to this Cluster'
' model.') ' model.'))
@utils.arg('--fixed-subnet', @utils.arg('--fixed-subnet',
metavar='<fixed-subnet>', metavar='<fixed-subnet>',
help='The private Neutron subnet name to connect to Cluster.') help=_('The private Neutron subnet name to connect to Cluster.'))
@utils.arg('--network-driver', @utils.arg('--network-driver',
metavar='<network-driver>', metavar='<network-driver>',
help='The network driver name for instantiating container' help=_('The network driver name for instantiating container'
' networks.') ' networks.'))
@utils.arg('--volume-driver', @utils.arg('--volume-driver',
metavar='<volume-driver>', metavar='<volume-driver>',
help='The volume driver name for instantiating container' help=_('The volume driver name for instantiating container'
' volume.') ' volume.'))
@utils.arg('--dns-nameserver', @utils.arg('--dns-nameserver',
metavar='<dns-nameserver>', metavar='<dns-nameserver>',
default='8.8.8.8', default='8.8.8.8',
help='The DNS nameserver to use for this cluster template.') help=_('The DNS nameserver to use for this cluster template.'))
@utils.arg('--flavor-id', @utils.arg('--flavor-id',
dest='flavor', dest='flavor',
metavar='<flavor>', metavar='<flavor>',
@ -107,8 +107,8 @@ def _show_cluster_template(cluster_template):
dest='flavor', dest='flavor',
metavar='<flavor>', metavar='<flavor>',
default='m1.medium', default='m1.medium',
help='The nova flavor name or UUID to use when launching the ' help=_('The nova flavor name or UUID to use when launching the '
'Cluster.') 'Cluster.'))
@utils.arg('--master-flavor-id', @utils.arg('--master-flavor-id',
dest='master_flavor', dest='master_flavor',
metavar='<master-flavor>', metavar='<master-flavor>',
@ -118,55 +118,55 @@ def _show_cluster_template(cluster_template):
@utils.arg('--master-flavor', @utils.arg('--master-flavor',
dest='master_flavor', dest='master_flavor',
metavar='<master-flavor>', metavar='<master-flavor>',
help='The nova flavor name or UUID to use when launching the master' help=_('The nova flavor name or UUID to use when launching the'
' node of the Cluster.') ' master node of the Cluster.'))
@utils.arg('--docker-volume-size', @utils.arg('--docker-volume-size',
metavar='<docker-volume-size>', metavar='<docker-volume-size>',
type=int, type=int,
help='Specify the number of size in GB ' help=_('Specify the number of size in GB '
'for the docker volume to use.') 'for the docker volume to use.'))
@utils.arg('--docker-storage-driver', @utils.arg('--docker-storage-driver',
metavar='<docker-storage-driver>', metavar='<docker-storage-driver>',
default='devicemapper', default='devicemapper',
help='Select a docker storage driver. Supported: devicemapper, ' help=_('Select a docker storage driver. Supported: devicemapper, '
'overlay. Default: devicemapper') 'overlay. Default: devicemapper'))
@utils.arg('--http-proxy', @utils.arg('--http-proxy',
metavar='<http-proxy>', metavar='<http-proxy>',
help='The http_proxy address to use for nodes in Cluster.') help=_('The http_proxy address to use for nodes in Cluster.'))
@utils.arg('--https-proxy', @utils.arg('--https-proxy',
metavar='<https-proxy>', metavar='<https-proxy>',
help='The https_proxy address to use for nodes in Cluster.') help=_('The https_proxy address to use for nodes in Cluster.'))
@utils.arg('--no-proxy', @utils.arg('--no-proxy',
metavar='<no-proxy>', metavar='<no-proxy>',
help='The no_proxy address to use for nodes in Cluster.') help=_('The no_proxy address to use for nodes in Cluster.'))
@utils.arg('--labels', metavar='<KEY1=VALUE1,KEY2=VALUE2;KEY3=VALUE3...>', @utils.arg('--labels', metavar='<KEY1=VALUE1,KEY2=VALUE2;KEY3=VALUE3...>',
action='append', default=[], action='append', default=[],
help='Arbitrary labels in the form of key=value pairs ' help=_('Arbitrary labels in the form of key=value pairs '
'to associate with a cluster template. ' 'to associate with a cluster template. '
'May be used multiple times.') 'May be used multiple times.'))
@utils.arg('--tls-disabled', @utils.arg('--tls-disabled',
action='store_true', default=False, action='store_true', default=False,
help='Disable TLS in the Cluster.') help=_('Disable TLS in the Cluster.'))
@utils.arg('--public', @utils.arg('--public',
action='store_true', default=False, action='store_true', default=False,
help='Make cluster template public.') help=_('Make cluster template public.'))
@utils.arg('--registry-enabled', @utils.arg('--registry-enabled',
action='store_true', default=False, action='store_true', default=False,
help='Enable docker registry in the Cluster') help=_('Enable docker registry in the Cluster'))
@utils.arg('--server-type', @utils.arg('--server-type',
metavar='<server-type>', metavar='<server-type>',
default='vm', default='vm',
help='Specify the server type to be used ' help=_('Specify the server type to be used '
'for example vm. For this release ' 'for example vm. For this release '
'default server type will be vm.') 'default server type will be vm.'))
@utils.arg('--master-lb-enabled', @utils.arg('--master-lb-enabled',
action='store_true', default=False, action='store_true', default=False,
help='Indicates whether created Clusters should have a load ' help=_('Indicates whether created Clusters should have a load '
'balancer for master nodes or not.') 'balancer for master nodes or not.'))
@utils.arg('--floating-ip-enabled', @utils.arg('--floating-ip-enabled',
action='store_true', default=True, action='store_true', default=True,
help='Indicates whether created Clusters should have a floating ip' help=_('Indicates whether created Clusters should have a '
'or not.') 'floating ip or not.'))
def do_cluster_template_create(cs, args): def do_cluster_template_create(cs, args):
"""Create a cluster template.""" """Create a cluster template."""
opts = {} opts = {}
@ -202,7 +202,7 @@ def do_cluster_template_create(cs, args):
@utils.arg('cluster_templates', @utils.arg('cluster_templates',
metavar='<cluster_templates>', metavar='<cluster_templates>',
nargs='+', nargs='+',
help='ID or name of the (cluster template)s to delete.') help=_('ID or name of the (cluster template)s to delete.'))
def do_cluster_template_delete(cs, args): def do_cluster_template_delete(cs, args):
"""Delete specified cluster template.""" """Delete specified cluster template."""
for cluster_template in args.cluster_templates: for cluster_template in args.cluster_templates:
@ -218,7 +218,7 @@ def do_cluster_template_delete(cs, args):
@utils.arg('cluster_template', @utils.arg('cluster_template',
metavar='<cluster_template>', metavar='<cluster_template>',
help='ID or name of the cluster template to show.') help=_('ID or name of the cluster template to show.'))
def do_cluster_template_show(cs, args): def do_cluster_template_show(cs, args):
"""Show details about the given cluster template.""" """Show details about the given cluster template."""
cluster_template = cs.cluster_templates.get(args.cluster_template) cluster_template = cs.cluster_templates.get(args.cluster_template)
@ -228,14 +228,14 @@ def do_cluster_template_show(cs, args):
@utils.arg('--limit', @utils.arg('--limit',
metavar='<limit>', metavar='<limit>',
type=int, type=int,
help='Maximum number of cluster templates to return') help=_('Maximum number of cluster templates to return'))
@utils.arg('--sort-key', @utils.arg('--sort-key',
metavar='<sort-key>', metavar='<sort-key>',
help='Column to sort results by') help=_('Column to sort results by'))
@utils.arg('--sort-dir', @utils.arg('--sort-dir',
metavar='<sort-dir>', metavar='<sort-dir>',
choices=['desc', 'asc'], choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".') help=_('Direction to sort. "asc" or "desc".'))
@utils.arg('--fields', @utils.arg('--fields',
default=None, default=None,
metavar='<fields>', metavar='<fields>',
@ -260,20 +260,20 @@ def do_cluster_template_list(cs, args):
@utils.arg('cluster_template', @utils.arg('cluster_template',
metavar='<cluster_template>', metavar='<cluster_template>',
help="UUID or name of cluster template") help=_("UUID or name of cluster template"))
@utils.arg( @utils.arg(
'op', 'op',
metavar='<op>', metavar='<op>',
choices=['add', 'replace', 'remove'], choices=['add', 'replace', 'remove'],
help="Operations: 'add', 'replace' or 'remove'") help=_("Operations: 'add', 'replace' or 'remove'"))
@utils.arg( @utils.arg(
'attributes', 'attributes',
metavar='<path=value>', metavar='<path=value>',
nargs='+', nargs='+',
action='append', action='append',
default=[], default=[],
help="Attributes to add/replace or remove " help=_("Attributes to add/replace or remove "
"(only PATH is necessary on remove)") "(only PATH is necessary on remove)"))
def do_cluster_template_update(cs, args): def do_cluster_template_update(cs, args):
"""Updates one or more cluster template attributes.""" """Updates one or more cluster template attributes."""
patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0]) patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0])

View File

@ -42,19 +42,19 @@ def _show_cluster(cluster):
@utils.arg('--marker', @utils.arg('--marker',
metavar='<marker>', metavar='<marker>',
default=None, default=None,
help='The last cluster UUID of the previous page; ' help=_('The last cluster UUID of the previous page; '
'displays list of clusters after "marker".') 'displays list of clusters after "marker".'))
@utils.arg('--limit', @utils.arg('--limit',
metavar='<limit>', metavar='<limit>',
type=int, type=int,
help='Maximum number of clusters to return.') help=_('Maximum number of clusters to return.'))
@utils.arg('--sort-key', @utils.arg('--sort-key',
metavar='<sort-key>', metavar='<sort-key>',
help='Column to sort results by.') help=_('Column to sort results by.'))
@utils.arg('--sort-dir', @utils.arg('--sort-dir',
metavar='<sort-dir>', metavar='<sort-dir>',
choices=['desc', 'asc'], choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".') help=_('Direction to sort. "asc" or "desc".'))
@utils.arg('--fields', @utils.arg('--fields',
default=None, default=None,
metavar='<fields>', metavar='<fields>',
@ -84,11 +84,11 @@ def do_cluster_list(cs, args):
@utils.deprecation_map(DEPRECATING_PARAMS) @utils.deprecation_map(DEPRECATING_PARAMS)
@utils.arg('--name', @utils.arg('--name',
metavar='<name>', metavar='<name>',
help='Name of the cluster to create.') help=_('Name of the cluster to create.'))
@utils.arg('--cluster-template', @utils.arg('--cluster-template',
required=True, required=True,
metavar='<cluster_template>', metavar='<cluster_template>',
help='ID or name of the cluster template.') help=_('ID or name of the cluster template.'))
@utils.arg('--keypair-id', @utils.arg('--keypair-id',
dest='keypair', dest='keypair',
metavar='<keypair>', metavar='<keypair>',
@ -100,26 +100,26 @@ def do_cluster_list(cs, args):
dest='keypair', dest='keypair',
metavar='<keypair>', metavar='<keypair>',
default=None, default=None,
help='UUID or name of the keypair to use for this cluster.') help=_('UUID or name of the keypair to use for this cluster.'))
@utils.arg('--node-count', @utils.arg('--node-count',
metavar='<node-count>', metavar='<node-count>',
type=int, type=int,
default=1, default=1,
help='The cluster node count.') help=_('The cluster node count.'))
@utils.arg('--master-count', @utils.arg('--master-count',
metavar='<master-count>', metavar='<master-count>',
type=int, type=int,
default=1, default=1,
help='The number of master nodes for the cluster.') help=_('The number of master nodes for the cluster.'))
@utils.arg('--discovery-url', @utils.arg('--discovery-url',
metavar='<discovery-url>', metavar='<discovery-url>',
help='Specifies custom discovery url for node discovery.') help=_('Specifies custom discovery url for node discovery.'))
@utils.arg('--timeout', @utils.arg('--timeout',
metavar='<timeout>', metavar='<timeout>',
type=int, type=int,
default=60, default=60,
help='The timeout for cluster creation in minutes. The default ' help=_('The timeout for cluster creation in minutes. The default '
'is 60 minutes.') 'is 60 minutes.'))
def do_cluster_create(cs, args): def do_cluster_create(cs, args):
"""Create a cluster.""" """Create a cluster."""
@ -149,7 +149,7 @@ def do_cluster_create(cs, args):
@utils.arg('cluster', @utils.arg('cluster',
metavar='<cluster>', metavar='<cluster>',
nargs='+', nargs='+',
help='ID or name of the (cluster)s to delete.') help=_('ID or name of the (cluster)s to delete.'))
def do_cluster_delete(cs, args): def do_cluster_delete(cs, args):
"""Delete specified cluster.""" """Delete specified cluster."""
for id in args.cluster: for id in args.cluster:
@ -164,10 +164,10 @@ def do_cluster_delete(cs, args):
@utils.arg('cluster', @utils.arg('cluster',
metavar='<cluster>', metavar='<cluster>',
help='ID or name of the cluster to show.') help=_('ID or name of the cluster to show.'))
@utils.arg('--long', @utils.arg('--long',
action='store_true', default=False, action='store_true', default=False,
help='Display extra associated cluster template info.') help=_('Display extra associated cluster template info.'))
def do_cluster_show(cs, args): def do_cluster_show(cs, args):
"""Show details about the given cluster.""" """Show details about the given cluster."""
cluster = cs.clusters.get(args.cluster) cluster = cs.clusters.get(args.cluster)
@ -183,23 +183,23 @@ def do_cluster_show(cs, args):
_show_cluster(cluster) _show_cluster(cluster)
@utils.arg('cluster', metavar='<cluster>', help="UUID or name of cluster") @utils.arg('cluster', metavar='<cluster>', help=_("UUID or name of cluster"))
@utils.arg('--rollback', @utils.arg('--rollback',
action='store_true', default=False, action='store_true', default=False,
help='Rollback cluster on update failure.') help=_('Rollback cluster on update failure.'))
@utils.arg( @utils.arg(
'op', 'op',
metavar='<op>', metavar='<op>',
choices=['add', 'replace', 'remove'], choices=['add', 'replace', 'remove'],
help="Operations: 'add', 'replace' or 'remove'") help=_("Operations: 'add', 'replace' or 'remove'"))
@utils.arg( @utils.arg(
'attributes', 'attributes',
metavar='<path=value>', metavar='<path=value>',
nargs='+', nargs='+',
action='append', action='append',
default=[], default=[],
help="Attributes to add/replace or remove " help=_("Attributes to add/replace or remove "
"(only PATH is necessary on remove)") "(only PATH is necessary on remove)"))
def do_cluster_update(cs, args): def do_cluster_update(cs, args):
"""Update information about the given cluster.""" """Update information about the given cluster."""
if args.rollback and args.magnum_api_version and \ if args.rollback and args.magnum_api_version and \
@ -217,14 +217,14 @@ def do_cluster_update(cs, args):
@utils.arg('cluster', @utils.arg('cluster',
metavar='<cluster>', metavar='<cluster>',
help='ID or name of the cluster to retrieve config.') help=_('ID or name of the cluster to retrieve config.'))
@utils.arg('--dir', @utils.arg('--dir',
metavar='<dir>', metavar='<dir>',
default='.', default='.',
help='Directory to save the certificate and config files.') help=_('Directory to save the certificate and config files.'))
@utils.arg('--force', @utils.arg('--force',
action='store_true', default=False, action='store_true', default=False,
help='Overwrite files if existing.') help=_('Overwrite files if existing.'))
def do_cluster_config(cs, args): def do_cluster_config(cs, args):
"""Configure native client to access cluster. """Configure native client to access cluster.