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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ def _show_cluster_template(cluster_template):
@utils.deprecation_map(DEPRECATING_PARAMS)
@utils.arg('--name',
metavar='<name>',
help='Name of the cluster template to create.')
help=_('Name of the cluster template to create.'))
@utils.arg('--image-id',
dest='image',
required=True,
@ -47,8 +47,8 @@ def _show_cluster_template(cluster_template):
dest='image',
required=True,
metavar='<image>',
help='The name or UUID of the base image to customize for the '
'Cluster.')
help=_('The name or UUID of the base image to customize for the '
'Cluster.'))
@utils.arg('--keypair-id',
dest='keypair',
metavar='<keypair>',
@ -58,8 +58,8 @@ def _show_cluster_template(cluster_template):
@utils.arg('--keypair',
dest='keypair',
metavar='<keypair>',
help='The name or UUID of the SSH keypair to load into the Cluster '
'nodes.')
help=_('The name or UUID of the SSH keypair to load into the '
'Cluster nodes.'))
@utils.arg('--external-network-id',
dest='external_network',
required=True,
@ -71,31 +71,31 @@ def _show_cluster_template(cluster_template):
dest='external_network',
required=True,
metavar='<external-network>',
help='The external Neutron network name or UUID to connect to '
'this Cluster Template.')
help=_('The external Neutron network name or UUID to connect to '
'this Cluster Template.'))
@utils.arg('--coe',
required=True,
metavar='<coe>',
help='Specify the Container Orchestration Engine to use.')
help=_('Specify the Container Orchestration Engine to use.'))
@utils.arg('--fixed-network',
metavar='<fixed-network>',
help='The private Neutron network name to connect to this Cluster'
' model.')
help=_('The private Neutron network name to connect to this Cluster'
' model.'))
@utils.arg('--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',
metavar='<network-driver>',
help='The network driver name for instantiating container'
' networks.')
help=_('The network driver name for instantiating container'
' networks.'))
@utils.arg('--volume-driver',
metavar='<volume-driver>',
help='The volume driver name for instantiating container'
' volume.')
help=_('The volume driver name for instantiating container'
' volume.'))
@utils.arg('--dns-nameserver',
metavar='<dns-nameserver>',
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',
dest='flavor',
metavar='<flavor>',
@ -107,8 +107,8 @@ def _show_cluster_template(cluster_template):
dest='flavor',
metavar='<flavor>',
default='m1.medium',
help='The nova flavor name or UUID to use when launching the '
'Cluster.')
help=_('The nova flavor name or UUID to use when launching the '
'Cluster.'))
@utils.arg('--master-flavor-id',
dest='master_flavor',
metavar='<master-flavor>',
@ -118,55 +118,55 @@ def _show_cluster_template(cluster_template):
@utils.arg('--master-flavor',
dest='master_flavor',
metavar='<master-flavor>',
help='The nova flavor name or UUID to use when launching the master'
' node of the Cluster.')
help=_('The nova flavor name or UUID to use when launching the'
' master node of the Cluster.'))
@utils.arg('--docker-volume-size',
metavar='<docker-volume-size>',
type=int,
help='Specify the number of size in GB '
'for the docker volume to use.')
help=_('Specify the number of size in GB '
'for the docker volume to use.'))
@utils.arg('--docker-storage-driver',
metavar='<docker-storage-driver>',
default='devicemapper',
help='Select a docker storage driver. Supported: devicemapper, '
'overlay. Default: devicemapper')
help=_('Select a docker storage driver. Supported: devicemapper, '
'overlay. Default: devicemapper'))
@utils.arg('--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',
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',
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...>',
action='append', default=[],
help='Arbitrary labels in the form of key=value pairs '
'to associate with a cluster template. '
'May be used multiple times.')
help=_('Arbitrary labels in the form of key=value pairs '
'to associate with a cluster template. '
'May be used multiple times.'))
@utils.arg('--tls-disabled',
action='store_true', default=False,
help='Disable TLS in the Cluster.')
help=_('Disable TLS in the Cluster.'))
@utils.arg('--public',
action='store_true', default=False,
help='Make cluster template public.')
help=_('Make cluster template public.'))
@utils.arg('--registry-enabled',
action='store_true', default=False,
help='Enable docker registry in the Cluster')
help=_('Enable docker registry in the Cluster'))
@utils.arg('--server-type',
metavar='<server-type>',
default='vm',
help='Specify the server type to be used '
'for example vm. For this release '
'default server type will be vm.')
help=_('Specify the server type to be used '
'for example vm. For this release '
'default server type will be vm.'))
@utils.arg('--master-lb-enabled',
action='store_true', default=False,
help='Indicates whether created Clusters should have a load '
'balancer for master nodes or not.')
help=_('Indicates whether created Clusters should have a load '
'balancer for master nodes or not.'))
@utils.arg('--floating-ip-enabled',
action='store_true', default=True,
help='Indicates whether created Clusters should have a floating ip'
'or not.')
help=_('Indicates whether created Clusters should have a '
'floating ip or not.'))
def do_cluster_template_create(cs, args):
"""Create a cluster template."""
opts = {}
@ -202,7 +202,7 @@ def do_cluster_template_create(cs, args):
@utils.arg('cluster_templates',
metavar='<cluster_templates>',
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):
"""Delete specified cluster template."""
for cluster_template in args.cluster_templates:
@ -218,7 +218,7 @@ def do_cluster_template_delete(cs, args):
@utils.arg('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):
"""Show details about the given 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',
metavar='<limit>',
type=int,
help='Maximum number of cluster templates to return')
help=_('Maximum number of cluster templates to return'))
@utils.arg('--sort-key',
metavar='<sort-key>',
help='Column to sort results by')
help=_('Column to sort results by'))
@utils.arg('--sort-dir',
metavar='<sort-dir>',
choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".')
help=_('Direction to sort. "asc" or "desc".'))
@utils.arg('--fields',
default=None,
metavar='<fields>',
@ -260,20 +260,20 @@ def do_cluster_template_list(cs, args):
@utils.arg('cluster_template',
metavar='<cluster_template>',
help="UUID or name of cluster template")
help=_("UUID or name of cluster template"))
@utils.arg(
'op',
metavar='<op>',
choices=['add', 'replace', 'remove'],
help="Operations: 'add', 'replace' or 'remove'")
help=_("Operations: 'add', 'replace' or 'remove'"))
@utils.arg(
'attributes',
metavar='<path=value>',
nargs='+',
action='append',
default=[],
help="Attributes to add/replace or remove "
"(only PATH is necessary on remove)")
help=_("Attributes to add/replace or remove "
"(only PATH is necessary on remove)"))
def do_cluster_template_update(cs, args):
"""Updates one or more cluster template attributes."""
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',
metavar='<marker>',
default=None,
help='The last cluster UUID of the previous page; '
'displays list of clusters after "marker".')
help=_('The last cluster UUID of the previous page; '
'displays list of clusters after "marker".'))
@utils.arg('--limit',
metavar='<limit>',
type=int,
help='Maximum number of clusters to return.')
help=_('Maximum number of clusters to return.'))
@utils.arg('--sort-key',
metavar='<sort-key>',
help='Column to sort results by.')
help=_('Column to sort results by.'))
@utils.arg('--sort-dir',
metavar='<sort-dir>',
choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".')
help=_('Direction to sort. "asc" or "desc".'))
@utils.arg('--fields',
default=None,
metavar='<fields>',
@ -84,11 +84,11 @@ def do_cluster_list(cs, args):
@utils.deprecation_map(DEPRECATING_PARAMS)
@utils.arg('--name',
metavar='<name>',
help='Name of the cluster to create.')
help=_('Name of the cluster to create.'))
@utils.arg('--cluster-template',
required=True,
metavar='<cluster_template>',
help='ID or name of the cluster template.')
help=_('ID or name of the cluster template.'))
@utils.arg('--keypair-id',
dest='keypair',
metavar='<keypair>',
@ -100,26 +100,26 @@ def do_cluster_list(cs, args):
dest='keypair',
metavar='<keypair>',
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',
metavar='<node-count>',
type=int,
default=1,
help='The cluster node count.')
help=_('The cluster node count.'))
@utils.arg('--master-count',
metavar='<master-count>',
type=int,
default=1,
help='The number of master nodes for the cluster.')
help=_('The number of master nodes for the cluster.'))
@utils.arg('--discovery-url',
metavar='<discovery-url>',
help='Specifies custom discovery url for node discovery.')
help=_('Specifies custom discovery url for node discovery.'))
@utils.arg('--timeout',
metavar='<timeout>',
type=int,
default=60,
help='The timeout for cluster creation in minutes. The default '
'is 60 minutes.')
help=_('The timeout for cluster creation in minutes. The default '
'is 60 minutes.'))
def do_cluster_create(cs, args):
"""Create a cluster."""
@ -149,7 +149,7 @@ def do_cluster_create(cs, args):
@utils.arg('cluster',
metavar='<cluster>',
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):
"""Delete specified cluster."""
for id in args.cluster:
@ -164,10 +164,10 @@ def do_cluster_delete(cs, args):
@utils.arg('cluster',
metavar='<cluster>',
help='ID or name of the cluster to show.')
help=_('ID or name of the cluster to show.'))
@utils.arg('--long',
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):
"""Show details about the given cluster."""
cluster = cs.clusters.get(args.cluster)
@ -183,23 +183,23 @@ def do_cluster_show(cs, args):
_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',
action='store_true', default=False,
help='Rollback cluster on update failure.')
help=_('Rollback cluster on update failure.'))
@utils.arg(
'op',
metavar='<op>',
choices=['add', 'replace', 'remove'],
help="Operations: 'add', 'replace' or 'remove'")
help=_("Operations: 'add', 'replace' or 'remove'"))
@utils.arg(
'attributes',
metavar='<path=value>',
nargs='+',
action='append',
default=[],
help="Attributes to add/replace or remove "
"(only PATH is necessary on remove)")
help=_("Attributes to add/replace or remove "
"(only PATH is necessary on remove)"))
def do_cluster_update(cs, args):
"""Update information about the given cluster."""
if args.rollback and args.magnum_api_version and \
@ -217,14 +217,14 @@ def do_cluster_update(cs, args):
@utils.arg('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',
metavar='<dir>',
default='.',
help='Directory to save the certificate and config files.')
help=_('Directory to save the certificate and config files.'))
@utils.arg('--force',
action='store_true', default=False,
help='Overwrite files if existing.')
help=_('Overwrite files if existing.'))
def do_cluster_config(cs, args):
"""Configure native client to access cluster.