Merge "i18n support for help and error messages in cinder"
This commit is contained in:
		| @@ -16,6 +16,7 @@ | ||||
| import logging | ||||
|  | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
| LOG = logging.getLogger(__name__) | ||||
|  | ||||
| @@ -73,7 +74,7 @@ def build_option_parser(parser): | ||||
|         '--os-volume-api-version', | ||||
|         metavar='<volume-api-version>', | ||||
|         default=utils.env('OS_VOLUME_API_VERSION'), | ||||
|         help='Volume API version, default=' + | ||||
|              DEFAULT_API_VERSION + | ||||
|              ' (Env: OS_VOLUME_API_VERSION)') | ||||
|         help=_('Volume API version, default=%s ' | ||||
|                '(Env: OS_VOLUME_API_VERSION)') % DEFAULT_API_VERSION | ||||
|     ) | ||||
|     return parser | ||||
|   | ||||
| @@ -20,6 +20,7 @@ import six | ||||
|  | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class CreateBackup(command.ShowOne): | ||||
| @@ -30,23 +31,23 @@ class CreateBackup(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to backup (name or ID)', | ||||
|             help=_('Volume to backup (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--container', | ||||
|             metavar='<container>', | ||||
|             required=False, | ||||
|             help='Optional backup container name', | ||||
|             help=_('Optional backup container name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='Name of the backup', | ||||
|             help=_('Name of the backup'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='Description of the backup', | ||||
|             help=_('Description of the backup'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -74,7 +75,7 @@ class DeleteBackup(command.Command): | ||||
|             'backups', | ||||
|             metavar='<backup>', | ||||
|             nargs="+", | ||||
|             help='Backup(s) to delete (ID only)', | ||||
|             help=_('Backup(s) to delete (ID only)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -95,7 +96,7 @@ class ListBackup(command.Lister): | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output', | ||||
|             help=_('List additional fields in output'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -148,11 +149,13 @@ class RestoreBackup(command.Command): | ||||
|         parser.add_argument( | ||||
|             'backup', | ||||
|             metavar='<backup>', | ||||
|             help='Backup to restore (ID only)') | ||||
|             help=_('Backup to restore (ID only)') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to restore to (name or ID)') | ||||
|             help=_('Volume to restore to (name or ID)') | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|     def take_action(self, parsed_args): | ||||
| @@ -173,7 +176,8 @@ class ShowBackup(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'backup', | ||||
|             metavar='<backup>', | ||||
|             help='Backup to display (ID only)') | ||||
|             help=_('Backup to display (ID only)') | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|     def take_action(self, parsed_args): | ||||
|   | ||||
| @@ -20,6 +20,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class AssociateQos(command.Command): | ||||
| @@ -30,12 +31,12 @@ class AssociateQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to associate the QoS (name or ID)', | ||||
|             help=_('Volume type to associate the QoS (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -57,7 +58,7 @@ class CreateQos(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'name', | ||||
|             metavar='<name>', | ||||
|             help='New QoS specification name', | ||||
|             help=_('New QoS specification name'), | ||||
|         ) | ||||
|         consumer_choices = ['front-end', 'back-end', 'both'] | ||||
|         parser.add_argument( | ||||
| @@ -65,15 +66,16 @@ class CreateQos(command.ShowOne): | ||||
|             metavar='<consumer>', | ||||
|             choices=consumer_choices, | ||||
|             default='both', | ||||
|             help='Consumer of the QoS. Valid consumers: %s ' | ||||
|                  "(defaults to 'both')" % utils.format_list(consumer_choices) | ||||
|             help=(_('Consumer of the QoS. Valid consumers: %s ' | ||||
|                     "(defaults to 'both')") % | ||||
|                   utils.format_list(consumer_choices)) | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a QoS specification property ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a QoS specification property ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -99,7 +101,7 @@ class DeleteQos(command.Command): | ||||
|             'qos_specs', | ||||
|             metavar='<qos-spec>', | ||||
|             nargs="+", | ||||
|             help='QoS specification(s) to delete (name or ID)', | ||||
|             help=_('QoS specification(s) to delete (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -118,19 +120,19 @@ class DisassociateQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         volume_type_group = parser.add_mutually_exclusive_group() | ||||
|         volume_type_group.add_argument( | ||||
|             '--volume-type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to disassociate the QoS from (name or ID)', | ||||
|             help=_('Volume type to disassociate the QoS from (name or ID)'), | ||||
|         ) | ||||
|         volume_type_group.add_argument( | ||||
|             '--all', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Disassociate the QoS from every volume type', | ||||
|             help=_('Disassociate the QoS from every volume type'), | ||||
|         ) | ||||
|  | ||||
|         return parser | ||||
| @@ -181,14 +183,14 @@ class SetQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Property to add or modify for this QoS specification ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Property to add or modify for this QoS specification ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -201,7 +203,7 @@ class SetQos(command.Command): | ||||
|             volume_client.qos_specs.set_keys(qos_spec.id, | ||||
|                                              parsed_args.property) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|  | ||||
|  | ||||
| class ShowQos(command.ShowOne): | ||||
| @@ -212,7 +214,7 @@ class ShowQos(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to display (name or ID)', | ||||
|             help=_('QoS specification to display (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -241,15 +243,15 @@ class UnsetQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             default=[], | ||||
|             help='Property to remove from the QoS specification. ' | ||||
|                  '(repeat option to unset multiple properties)', | ||||
|             help=_('Property to remove from the QoS specification. ' | ||||
|                    '(repeat option to unset multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -262,4 +264,4 @@ class UnsetQos(command.Command): | ||||
|             volume_client.qos_specs.unset_keys(qos_spec.id, | ||||
|                                                parsed_args.property) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
|  | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class ListService(command.Lister): | ||||
| @@ -26,16 +27,18 @@ class ListService(command.Lister): | ||||
|         parser.add_argument( | ||||
|             "--host", | ||||
|             metavar="<host>", | ||||
|             help="List services on specified host (name only)") | ||||
|             help=_("List services on specified host (name only)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--service", | ||||
|             metavar="<service>", | ||||
|             help="List only specified service (name only)") | ||||
|             help=_("List only specified service (name only)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--long", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="List additional fields in output" | ||||
|             help=_("List additional fields in output") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class CreateSnapshot(command.ShowOne): | ||||
| @@ -31,24 +32,25 @@ class CreateSnapshot(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to snapshot (name or ID)', | ||||
|             help=_('Volume to snapshot (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='Name of the snapshot', | ||||
|             help=_('Name of the snapshot'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='Description of the snapshot', | ||||
|             help=_('Description of the snapshot'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--force', | ||||
|             dest='force', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Create a snapshot attached to an instance. Default is False', | ||||
|             help=_('Create a snapshot attached to an instance. ' | ||||
|                    'Default is False'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -79,7 +81,7 @@ class DeleteSnapshot(command.Command): | ||||
|             'snapshots', | ||||
|             metavar='<snapshot>', | ||||
|             nargs="+", | ||||
|             help='Snapshot(s) to delete (name or ID)', | ||||
|             help=_('Snapshot(s) to delete (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -100,13 +102,13 @@ class ListSnapshot(command.Lister): | ||||
|             '--all-projects', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Include all projects (admin only)', | ||||
|             help=_('Include all projects (admin only)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output', | ||||
|             help=_('List additional fields in output'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -170,21 +172,24 @@ class SetSnapshot(command.Command): | ||||
|         parser.add_argument( | ||||
|             'snapshot', | ||||
|             metavar='<snapshot>', | ||||
|             help='Snapshot to modify (name or ID)') | ||||
|             help=_('Snapshot to modify (name or ID)') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='New snapshot name') | ||||
|             help=_('New snapshot name') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='New snapshot description') | ||||
|             help=_('New snapshot description') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Property to add/change for this snapshot ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Property to add/change for this snapshot ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -204,7 +209,7 @@ class SetSnapshot(command.Command): | ||||
|             kwargs['display_description'] = parsed_args.description | ||||
|  | ||||
|         if not kwargs and not parsed_args.property: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|             return | ||||
|  | ||||
|         snapshot.update(**kwargs) | ||||
| @@ -218,7 +223,8 @@ class ShowSnapshot(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'snapshot', | ||||
|             metavar='<snapshot>', | ||||
|             help='Snapshot to display (name or ID)') | ||||
|             help=_('Snapshot to display (name or ID)') | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|     def take_action(self, parsed_args): | ||||
| @@ -241,16 +247,16 @@ class UnsetSnapshot(command.Command): | ||||
|         parser.add_argument( | ||||
|             'snapshot', | ||||
|             metavar='<snapshot>', | ||||
|             help='Snapshot to modify (name or ID)', | ||||
|             help=_('Snapshot to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             default=[], | ||||
|             help='Property to remove from snapshot ' | ||||
|                  '(repeat option to remove multiple properties)', | ||||
|             required=True, | ||||
|             help=_('Property to remove from snapshot ' | ||||
|                    '(repeat option to remove multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -265,4 +271,4 @@ class UnsetSnapshot(command.Command): | ||||
|                 parsed_args.property, | ||||
|             ) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class CreateVolume(command.ShowOne): | ||||
| @@ -31,30 +32,30 @@ class CreateVolume(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'name', | ||||
|             metavar='<name>', | ||||
|             help='Volume name', | ||||
|             help=_('Volume name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--size', | ||||
|             metavar='<size>', | ||||
|             required=True, | ||||
|             type=int, | ||||
|             help='Volume size in GB', | ||||
|             help=_('Volume size in GB'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--type', | ||||
|             metavar='<volume-type>', | ||||
|             help="Set the type of volume", | ||||
|             help=_("Set the type of volume"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--image', | ||||
|             metavar='<image>', | ||||
|             help='Use <image> as source of volume (name or ID)', | ||||
|             help=_('Use <image> as source of volume (name or ID)'), | ||||
|         ) | ||||
|         snapshot_group = parser.add_mutually_exclusive_group() | ||||
|         snapshot_group.add_argument( | ||||
|             '--snapshot', | ||||
|             metavar='<snapshot>', | ||||
|             help='Use <snapshot> as source of volume (name or ID)', | ||||
|             help=_('Use <snapshot> as source of volume (name or ID)'), | ||||
|         ) | ||||
|         snapshot_group.add_argument( | ||||
|             '--snapshot-id', | ||||
| @@ -64,34 +65,34 @@ class CreateVolume(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             '--source', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to clone (name or ID)', | ||||
|             help=_('Volume to clone (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='Volume description', | ||||
|             help=_('Volume description'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--user', | ||||
|             metavar='<user>', | ||||
|             help='Specify an alternate user (name or ID)', | ||||
|             help=_('Specify an alternate user (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--project', | ||||
|             metavar='<project>', | ||||
|             help='Specify an alternate project (name or ID)', | ||||
|             help=_('Specify an alternate project (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--availability-zone', | ||||
|             metavar='<availability-zone>', | ||||
|             help='Create volume in <availability-zone>', | ||||
|             help=_('Create volume in <availability-zone>'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|  | ||||
|         return parser | ||||
| @@ -165,15 +166,15 @@ class DeleteVolume(command.Command): | ||||
|             'volumes', | ||||
|             metavar='<volume>', | ||||
|             nargs="+", | ||||
|             help='Volume(s) to delete (name or ID)', | ||||
|             help=_('Volume(s) to delete (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--force', | ||||
|             dest='force', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Attempt forced removal of volume(s), regardless of state ' | ||||
|                  '(defaults to False)', | ||||
|             help=_('Attempt forced removal of volume(s), regardless of state ' | ||||
|                    '(defaults to False)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -196,24 +197,24 @@ class ListVolume(command.Lister): | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='Filter results by volume name', | ||||
|             help=_('Filter results by volume name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--status', | ||||
|             metavar='<status>', | ||||
|             help='Filter results by status', | ||||
|             help=_('Filter results by status'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--all-projects', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Include all projects (admin only)', | ||||
|             help=_('Include all projects (admin only)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output', | ||||
|             help=_('List additional fields in output'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -308,30 +309,30 @@ class SetVolume(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to modify (name or ID)', | ||||
|             help=_('Volume to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='New volume name', | ||||
|             help=_('New volume name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='New volume description', | ||||
|             help=_('New volume description'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--size', | ||||
|             metavar='<size>', | ||||
|             type=int, | ||||
|             help='Extend volume size in GB', | ||||
|             help=_('Extend volume size in GB'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -341,12 +342,12 @@ class SetVolume(command.Command): | ||||
|  | ||||
|         if parsed_args.size: | ||||
|             if volume.status != 'available': | ||||
|                 self.app.log.error("Volume is in %s state, it must be " | ||||
|                                    "available before size can be extended" % | ||||
|                 self.app.log.error(_("Volume is in %s state, it must be " | ||||
|                                    "available before size can be extended") % | ||||
|                                    volume.status) | ||||
|                 return | ||||
|             if parsed_args.size <= volume.size: | ||||
|                 self.app.log.error("New size must be greater than %s GB" % | ||||
|                 self.app.log.error(_("New size must be greater than %s GB") % | ||||
|                                    volume.size) | ||||
|                 return | ||||
|             volume_client.volumes.extend(volume.id, parsed_args.size) | ||||
| @@ -363,7 +364,7 @@ class SetVolume(command.Command): | ||||
|             volume_client.volumes.update(volume.id, **kwargs) | ||||
|  | ||||
|         if not kwargs and not parsed_args.property and not parsed_args.size: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|  | ||||
|  | ||||
| class ShowVolume(command.ShowOne): | ||||
| @@ -374,7 +375,7 @@ class ShowVolume(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to display (name or ID)', | ||||
|             help=_('Volume to display (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -404,15 +405,15 @@ class UnsetVolume(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to modify (name or ID)', | ||||
|             help=_('Volume to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             default=[], | ||||
|             help='Remove a property from volume ' | ||||
|                  '(repeat option to remove multiple properties)', | ||||
|             help=_('Remove a property from volume ' | ||||
|                    '(repeat option to remove multiple properties)'), | ||||
|             required=True, | ||||
|         ) | ||||
|         return parser | ||||
| @@ -428,4 +429,4 @@ class UnsetVolume(command.Command): | ||||
|                 parsed_args.property, | ||||
|             ) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -20,6 +20,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class CreateVolumeType(command.ShowOne): | ||||
| @@ -30,14 +31,14 @@ class CreateVolumeType(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'name', | ||||
|             metavar='<name>', | ||||
|             help='Volume type name', | ||||
|             help=_('Volume type name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume type ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume type ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -62,7 +63,7 @@ class DeleteVolumeType(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to delete (name or ID)', | ||||
|             help=_('Volume type to delete (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -82,7 +83,8 @@ class ListVolumeType(command.Lister): | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output') | ||||
|             help=_('List additional fields in output') | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|     def take_action(self, parsed_args): | ||||
| @@ -108,14 +110,14 @@ class SetVolumeType(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to modify (name or ID)', | ||||
|             help=_('Volume type to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume type ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume type ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -136,7 +138,7 @@ class ShowVolumeType(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "volume_type", | ||||
|             metavar="<volume-type>", | ||||
|             help="Volume type to display (name or ID)" | ||||
|             help=_("Volume type to display (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -157,15 +159,15 @@ class UnsetVolumeType(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to modify (name or ID)', | ||||
|             help=_('Volume type to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             default=[], | ||||
|             help='Remove a property from this volume type ' | ||||
|                  '(repeat option to remove multiple properties)', | ||||
|             help=_('Remove a property from this volume type ' | ||||
|                    '(repeat option to remove multiple properties)'), | ||||
|             required=True, | ||||
|         ) | ||||
|         return parser | ||||
| @@ -180,4 +182,4 @@ class UnsetVolumeType(command.Command): | ||||
|         if parsed_args.property: | ||||
|             volume_type.unset_keys(parsed_args.property) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -20,6 +20,7 @@ import six | ||||
|  | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class CreateBackup(command.ShowOne): | ||||
| @@ -30,22 +31,22 @@ class CreateBackup(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "volume", | ||||
|             metavar="<volume>", | ||||
|             help="Volume to backup (name or ID)" | ||||
|             help=_("Volume to backup (name or ID)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--name", | ||||
|             metavar="<name>", | ||||
|             help="Name of the backup" | ||||
|             help=_("Name of the backup") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--description", | ||||
|             metavar="<description>", | ||||
|             help="Description of the backup" | ||||
|             help=_("Description of the backup") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--container", | ||||
|             metavar="<container>", | ||||
|             help="Optional backup container name" | ||||
|             help=_("Optional backup container name") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -72,7 +73,7 @@ class DeleteBackup(command.Command): | ||||
|             "backups", | ||||
|             metavar="<backup>", | ||||
|             nargs="+", | ||||
|             help="Backup(s) to delete (name or ID)" | ||||
|             help=_("Backup(s) to delete (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -93,7 +94,7 @@ class ListBackup(command.Lister): | ||||
|             "--long", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="List additional fields in output" | ||||
|             help=_("List additional fields in output") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -146,12 +147,12 @@ class RestoreBackup(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "backup", | ||||
|             metavar="<backup>", | ||||
|             help="Backup to restore (ID only)" | ||||
|             help=_("Backup to restore (ID only)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "volume", | ||||
|             metavar="<volume>", | ||||
|             help="Volume to restore to (name or ID)" | ||||
|             help=_("Volume to restore to (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -171,7 +172,8 @@ class ShowBackup(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "backup", | ||||
|             metavar="<backup>", | ||||
|             help="Backup to display (name or ID)") | ||||
|             help=_("Backup to display (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|     def take_action(self, parsed_args): | ||||
|   | ||||
| @@ -20,6 +20,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class AssociateQos(command.Command): | ||||
| @@ -30,12 +31,12 @@ class AssociateQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to associate the QoS (name or ID)', | ||||
|             help=_('Volume type to associate the QoS (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -57,7 +58,7 @@ class CreateQos(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'name', | ||||
|             metavar='<name>', | ||||
|             help='New QoS specification name', | ||||
|             help=_('New QoS specification name'), | ||||
|         ) | ||||
|         consumer_choices = ['front-end', 'back-end', 'both'] | ||||
|         parser.add_argument( | ||||
| @@ -65,15 +66,16 @@ class CreateQos(command.ShowOne): | ||||
|             metavar='<consumer>', | ||||
|             choices=consumer_choices, | ||||
|             default='both', | ||||
|             help='Consumer of the QoS. Valid consumers: %s ' | ||||
|                  "(defaults to 'both')" % utils.format_list(consumer_choices) | ||||
|             help=(_('Consumer of the QoS. Valid consumers: %s ' | ||||
|                   "(defaults to 'both')") % | ||||
|                   utils.format_list(consumer_choices)) | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a QoS specification property ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a QoS specification property ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -99,7 +101,7 @@ class DeleteQos(command.Command): | ||||
|             'qos_specs', | ||||
|             metavar='<qos-spec>', | ||||
|             nargs="+", | ||||
|             help='QoS specification(s) to delete (name or ID)', | ||||
|             help=_('QoS specification(s) to delete (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -118,19 +120,19 @@ class DisassociateQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         volume_type_group = parser.add_mutually_exclusive_group() | ||||
|         volume_type_group.add_argument( | ||||
|             '--volume-type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to disassociate the QoS from (name or ID)', | ||||
|             help=_('Volume type to disassociate the QoS from (name or ID)'), | ||||
|         ) | ||||
|         volume_type_group.add_argument( | ||||
|             '--all', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Disassociate the QoS from every volume type', | ||||
|             help=_('Disassociate the QoS from every volume type'), | ||||
|         ) | ||||
|  | ||||
|         return parser | ||||
| @@ -181,14 +183,14 @@ class SetQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Property to add or modify for this QoS specification ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Property to add or modify for this QoS specification ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -201,7 +203,7 @@ class SetQos(command.Command): | ||||
|             volume_client.qos_specs.set_keys(qos_spec.id, | ||||
|                                              parsed_args.property) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|  | ||||
|  | ||||
| class ShowQos(command.ShowOne): | ||||
| @@ -212,7 +214,7 @@ class ShowQos(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to display (name or ID)', | ||||
|             help=_('QoS specification to display (name or ID)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -241,15 +243,15 @@ class UnsetQos(command.Command): | ||||
|         parser.add_argument( | ||||
|             'qos_spec', | ||||
|             metavar='<qos-spec>', | ||||
|             help='QoS specification to modify (name or ID)', | ||||
|             help=_('QoS specification to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             default=[], | ||||
|             help='Property to remove from the QoS specification. ' | ||||
|                  '(repeat option to unset multiple properties)', | ||||
|             help=('Property to remove from the QoS specification. ' | ||||
|                   '(repeat option to unset multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -262,4 +264,4 @@ class UnsetQos(command.Command): | ||||
|             volume_client.qos_specs.unset_keys(qos_spec.id, | ||||
|                                                parsed_args.property) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
|  | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class ListService(command.Lister): | ||||
| @@ -26,16 +27,18 @@ class ListService(command.Lister): | ||||
|         parser.add_argument( | ||||
|             "--host", | ||||
|             metavar="<host>", | ||||
|             help="List services on specified host (name only)") | ||||
|             help=_("List services on specified host (name only)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--service", | ||||
|             metavar="<service>", | ||||
|             help="List only specified service (name only)") | ||||
|             help=_("List only specified service (name only)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--long", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="List additional fields in output" | ||||
|             help=_("List additional fields in output") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
|  | ||||
|  | ||||
| class CreateSnapshot(command.ShowOne): | ||||
| @@ -31,24 +32,25 @@ class CreateSnapshot(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "volume", | ||||
|             metavar="<volume>", | ||||
|             help="Volume to snapshot (name or ID)" | ||||
|             help=_("Volume to snapshot (name or ID)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--name", | ||||
|             metavar="<name>", | ||||
|             help="Name of the snapshot" | ||||
|             help=("Name of the snapshot") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--description", | ||||
|             metavar="<description>", | ||||
|             help="Description of the snapshot" | ||||
|             help=_("Description of the snapshot") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--force", | ||||
|             dest="force", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="Create a snapshot attached to an instance. Default is False" | ||||
|             help=_("Create a snapshot attached to an instance. " | ||||
|                    "Default is False") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -77,7 +79,7 @@ class DeleteSnapshot(command.Command): | ||||
|             "snapshots", | ||||
|             metavar="<snapshot>", | ||||
|             nargs="+", | ||||
|             help="Snapshot(s) to delete (name or ID)" | ||||
|             help=_("Snapshot(s) to delete (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -98,13 +100,13 @@ class ListSnapshot(command.Lister): | ||||
|             '--all-projects', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Include all projects (admin only)', | ||||
|             help=_('Include all projects (admin only)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output', | ||||
|             help=_('List additional fields in output'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -163,29 +165,32 @@ class SetSnapshot(command.Command): | ||||
|         parser.add_argument( | ||||
|             'snapshot', | ||||
|             metavar='<snapshot>', | ||||
|             help='Snapshot to modify (name or ID)') | ||||
|             help=_('Snapshot to modify (name or ID)') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='New snapshot name') | ||||
|             help=_('New snapshot name') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='New snapshot description') | ||||
|             help=_('New snapshot description') | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Property to add/change for this snapshot ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Property to add/change for this snapshot ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--state', | ||||
|             metavar='<state>', | ||||
|             choices=['available', 'error', 'creating', 'deleting', | ||||
|                      'error-deleting'], | ||||
|             help='New snapshot state. Valid values are available, ' | ||||
|                  'error, creating, deleting, and error-deleting.', | ||||
|             help=_('New snapshot state. Valid values are available, ' | ||||
|                    'error, creating, deleting, and error-deleting.'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -202,7 +207,7 @@ class SetSnapshot(command.Command): | ||||
|  | ||||
|         if (not kwargs and not parsed_args.property and not | ||||
|                 parsed_args.state): | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|             return | ||||
|  | ||||
|         if parsed_args.property: | ||||
| @@ -222,7 +227,7 @@ class ShowSnapshot(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "snapshot", | ||||
|             metavar="<snapshot>", | ||||
|             help="Snapshot to display (name or ID)" | ||||
|             help=_("Snapshot to display (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -244,15 +249,15 @@ class UnsetSnapshot(command.Command): | ||||
|         parser.add_argument( | ||||
|             'snapshot', | ||||
|             metavar='<snapshot>', | ||||
|             help='Snapshot to modify (name or ID)', | ||||
|             help=_('Snapshot to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             default=[], | ||||
|             help='Property to remove from snapshot ' | ||||
|                  '(repeat option to remove multiple properties)', | ||||
|             help=_('Property to remove from snapshot ' | ||||
|                    '(repeat option to remove multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -267,4 +272,4 @@ class UnsetSnapshot(command.Command): | ||||
|                 parsed_args.property, | ||||
|             ) | ||||
|         else: | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import six | ||||
| from openstackclient.common import command | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
| from openstackclient.identity import common as identity_common | ||||
|  | ||||
|  | ||||
| @@ -32,61 +33,61 @@ class CreateVolume(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "name", | ||||
|             metavar="<name>", | ||||
|             help="Volume name", | ||||
|             help=_("Volume name"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--size", | ||||
|             metavar="<size>", | ||||
|             type=int, | ||||
|             required=True, | ||||
|             help="Volume size in GB", | ||||
|             help=_("Volume size in GB"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--type", | ||||
|             metavar="<volume-type>", | ||||
|             help="Set the type of volume", | ||||
|             help=_("Set the type of volume"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--image", | ||||
|             metavar="<image>", | ||||
|             help="Use <image> as source of volume (name or ID)", | ||||
|             help=_("Use <image> as source of volume (name or ID)"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--snapshot", | ||||
|             metavar="<snapshot>", | ||||
|             help="Use <snapshot> as source of volume (name or ID)", | ||||
|             help=_("Use <snapshot> as source of volume (name or ID)"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--source", | ||||
|             metavar="<volume>", | ||||
|             help="Volume to clone (name or ID)", | ||||
|             help=_("Volume to clone (name or ID)"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--description", | ||||
|             metavar="<description>", | ||||
|             help="Volume description", | ||||
|             help=_("Volume description"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--user', | ||||
|             metavar='<user>', | ||||
|             help='Specify an alternate user (name or ID)', | ||||
|             help=_('Specify an alternate user (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--project', | ||||
|             metavar='<project>', | ||||
|             help='Specify an alternate project (name or ID)', | ||||
|             help=_('Specify an alternate project (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--availability-zone", | ||||
|             metavar="<availability-zone>", | ||||
|             help="Create volume in <availability-zone>", | ||||
|             help=_("Create volume in <availability-zone>"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--property", | ||||
|             metavar="<key=value>", | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help="Set a property to this volume " | ||||
|                  "(repeat option to set multiple properties)", | ||||
|             help=_("Set a property to this volume " | ||||
|                    "(repeat option to set multiple properties)"), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -158,15 +159,15 @@ class DeleteVolume(command.Command): | ||||
|             "volumes", | ||||
|             metavar="<volume>", | ||||
|             nargs="+", | ||||
|             help="Volume(s) to delete (name or ID)" | ||||
|             help=_("Volume(s) to delete (name or ID)") | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--force", | ||||
|             dest="force", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="Attempt forced removal of volume(s), regardless of state " | ||||
|                  "(defaults to False)" | ||||
|             help=_("Attempt forced removal of volume(s), regardless of state " | ||||
|                    "(defaults to False)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -189,36 +190,36 @@ class ListVolume(command.Lister): | ||||
|         parser.add_argument( | ||||
|             '--project', | ||||
|             metavar='<project>', | ||||
|             help='Filter results by project (name or ID) (admin only)' | ||||
|             help=_('Filter results by project (name or ID) (admin only)') | ||||
|         ) | ||||
|         identity_common.add_project_domain_option_to_parser(parser) | ||||
|         parser.add_argument( | ||||
|             '--user', | ||||
|             metavar='<user>', | ||||
|             help='Filter results by user (name or ID) (admin only)' | ||||
|             help=_('Filter results by user (name or ID) (admin only)') | ||||
|         ) | ||||
|         identity_common.add_user_domain_option_to_parser(parser) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='Filter results by volume name', | ||||
|             help=_('Filter results by volume name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--status', | ||||
|             metavar='<status>', | ||||
|             help='Filter results by status', | ||||
|             help=_('Filter results by status'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--all-projects', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='Include all projects (admin only)', | ||||
|             help=_('Include all projects (admin only)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output', | ||||
|             help=_('List additional fields in output'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -320,37 +321,37 @@ class SetVolume(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to modify (name or ID)', | ||||
|             help=_('Volume to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='New volume name', | ||||
|             help=_('New volume name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--size', | ||||
|             metavar='<size>', | ||||
|             type=int, | ||||
|             help='Extend volume size in GB', | ||||
|             help=_('Extend volume size in GB'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<description>', | ||||
|             help='New volume description', | ||||
|             help=_('New volume description'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--image-property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set an image property on this volume ' | ||||
|                  '(repeat option to set multiple image properties)', | ||||
|             help=_('Set an image property on this volume ' | ||||
|                    '(repeat option to set multiple image properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -360,12 +361,12 @@ class SetVolume(command.Command): | ||||
|  | ||||
|         if parsed_args.size: | ||||
|             if volume.status != 'available': | ||||
|                 self.app.log.error("Volume is in %s state, it must be " | ||||
|                                    "available before size can be extended" % | ||||
|                 self.app.log.error(_("Volume is in %s state, it must be " | ||||
|                                    "available before size can be extended") % | ||||
|                                    volume.status) | ||||
|                 return | ||||
|             if parsed_args.size <= volume.size: | ||||
|                 self.app.log.error("New size must be greater than %s GB" % | ||||
|                 self.app.log.error(_("New size must be greater than %s GB") % | ||||
|                                    volume.size) | ||||
|                 return | ||||
|             volume_client.volumes.extend(volume.id, parsed_args.size) | ||||
| @@ -386,7 +387,7 @@ class SetVolume(command.Command): | ||||
|  | ||||
|         if (not kwargs and not parsed_args.property | ||||
|            and not parsed_args.image_property and not parsed_args.size): | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|  | ||||
|  | ||||
| class ShowVolume(command.ShowOne): | ||||
| @@ -397,7 +398,7 @@ class ShowVolume(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar="<volume-id>", | ||||
|             help="Volume to display (name or ID)" | ||||
|             help=_("Volume to display (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -428,21 +429,21 @@ class UnsetVolume(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume', | ||||
|             metavar='<volume>', | ||||
|             help='Volume to modify (name or ID)', | ||||
|             help=_('Volume to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             help='Remove a property from volume ' | ||||
|                  '(repeat option to remove multiple properties)', | ||||
|             help=_('Remove a property from volume ' | ||||
|                    '(repeat option to remove multiple properties)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--image-property', | ||||
|             metavar='<key>', | ||||
|             action='append', | ||||
|             help='Remove an image property from volume ' | ||||
|                  '(repeat option to remove multiple image properties)', | ||||
|             help=_('Remove an image property from volume ' | ||||
|                    '(repeat option to remove multiple image properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -459,4 +460,4 @@ class UnsetVolume(command.Command): | ||||
|                 volume.id, parsed_args.image_property) | ||||
|  | ||||
|         if (not parsed_args.image_property and not parsed_args.property): | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|   | ||||
| @@ -20,6 +20,7 @@ from openstackclient.common import command | ||||
| from openstackclient.common import exceptions | ||||
| from openstackclient.common import parseractions | ||||
| from openstackclient.common import utils | ||||
| from openstackclient.i18n import _ | ||||
| from openstackclient.identity import common as identity_common | ||||
|  | ||||
|  | ||||
| @@ -31,12 +32,12 @@ class CreateVolumeType(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "name", | ||||
|             metavar="<name>", | ||||
|             help="Volume type name", | ||||
|             help=_("Volume type name"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             "--description", | ||||
|             metavar="<description>", | ||||
|             help="Volume type description", | ||||
|             help=_("Volume type description"), | ||||
|         ) | ||||
|         public_group = parser.add_mutually_exclusive_group() | ||||
|         public_group.add_argument( | ||||
| @@ -44,21 +45,21 @@ class CreateVolumeType(command.ShowOne): | ||||
|             dest="public", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="Volume type is accessible to the public", | ||||
|             help=_("Volume type is accessible to the public"), | ||||
|         ) | ||||
|         public_group.add_argument( | ||||
|             "--private", | ||||
|             dest="private", | ||||
|             action="store_true", | ||||
|             default=False, | ||||
|             help="Volume type is not accessible to the public", | ||||
|             help=_("Volume type is not accessible to the public"), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume type ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume type ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -93,7 +94,7 @@ class DeleteVolumeType(command.Command): | ||||
|         parser.add_argument( | ||||
|             "volume_type", | ||||
|             metavar="<volume-type>", | ||||
|             help="Volume type to delete (name or ID)" | ||||
|             help=_("Volume type to delete (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -113,7 +114,7 @@ class ListVolumeType(command.Lister): | ||||
|             '--long', | ||||
|             action='store_true', | ||||
|             default=False, | ||||
|             help='List additional fields in output') | ||||
|             help=_('List additional fields in output')) | ||||
|         return parser | ||||
|  | ||||
|     def take_action(self, parsed_args): | ||||
| @@ -139,29 +140,30 @@ class SetVolumeType(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to modify (name or ID)', | ||||
|             help=_('Volume type to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--name', | ||||
|             metavar='<name>', | ||||
|             help='Set volume type name', | ||||
|             help=_('Set volume type name'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--description', | ||||
|             metavar='<name>', | ||||
|             help='Set volume type description', | ||||
|             help=_('Set volume type description'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key=value>', | ||||
|             action=parseractions.KeyValueAction, | ||||
|             help='Set a property on this volume type ' | ||||
|                  '(repeat option to set multiple properties)', | ||||
|             help=_('Set a property on this volume type ' | ||||
|                    '(repeat option to set multiple properties)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--project', | ||||
|             metavar='<project>', | ||||
|             help='Set volume type access to project (name or ID) (admin only)', | ||||
|             help=_('Set volume type access to project (name or ID) ' | ||||
|                    '(admin only)'), | ||||
|         ) | ||||
|         identity_common.add_project_domain_option_to_parser(parser) | ||||
|  | ||||
| @@ -178,7 +180,7 @@ class SetVolumeType(command.Command): | ||||
|                 and not parsed_args.description | ||||
|                 and not parsed_args.property | ||||
|                 and not parsed_args.project): | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|             return | ||||
|  | ||||
|         result = 0 | ||||
| @@ -195,15 +197,15 @@ class SetVolumeType(command.Command): | ||||
|                     **kwargs | ||||
|                 ) | ||||
|             except Exception as e: | ||||
|                 self.app.log.error("Failed to update volume type name or" | ||||
|                                    " description: " + str(e)) | ||||
|                 self.app.log.error(_("Failed to update volume type name or" | ||||
|                                      " description: %s") % str(e)) | ||||
|                 result += 1 | ||||
|  | ||||
|         if parsed_args.property: | ||||
|             try: | ||||
|                 volume_type.set_keys(parsed_args.property) | ||||
|             except Exception as e: | ||||
|                 self.app.log.error("Failed to set volume type property: " + | ||||
|                 self.app.log.error(_("Failed to set volume type property: ") + | ||||
|                                    str(e)) | ||||
|                 result += 1 | ||||
|  | ||||
| @@ -218,8 +220,8 @@ class SetVolumeType(command.Command): | ||||
|                 volume_client.volume_type_access.add_project_access( | ||||
|                     volume_type.id, project_info.id) | ||||
|             except Exception as e: | ||||
|                 self.app.log.error("Failed to set volume type access to" | ||||
|                                    " project: " + str(e)) | ||||
|                 self.app.log.error(_("Failed to set volume type access to" | ||||
|                                      " project: %s") % str(e)) | ||||
|                 result += 1 | ||||
|  | ||||
|         if result > 0: | ||||
| @@ -235,7 +237,7 @@ class ShowVolumeType(command.ShowOne): | ||||
|         parser.add_argument( | ||||
|             "volume_type", | ||||
|             metavar="<volume-type>", | ||||
|             help="Volume type to display (name or ID)" | ||||
|             help=_("Volume type to display (name or ID)") | ||||
|         ) | ||||
|         return parser | ||||
|  | ||||
| @@ -256,19 +258,19 @@ class UnsetVolumeType(command.Command): | ||||
|         parser.add_argument( | ||||
|             'volume_type', | ||||
|             metavar='<volume-type>', | ||||
|             help='Volume type to modify (name or ID)', | ||||
|             help=_('Volume type to modify (name or ID)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--property', | ||||
|             metavar='<key>', | ||||
|             help='Remove a property from this volume type ' | ||||
|                  '(repeat option to remove multiple properties)', | ||||
|             help=_('Remove a property from this volume type ' | ||||
|                    '(repeat option to remove multiple properties)'), | ||||
|         ) | ||||
|         parser.add_argument( | ||||
|             '--project', | ||||
|             metavar='<project>', | ||||
|             help='Removes volume type access to project (name or ID) ' | ||||
|                  ' (admin only)', | ||||
|             help=_('Removes volume type access to project (name or ID) ' | ||||
|                    ' (admin only)'), | ||||
|         ) | ||||
|         identity_common.add_project_domain_option_to_parser(parser) | ||||
|  | ||||
| @@ -285,7 +287,7 @@ class UnsetVolumeType(command.Command): | ||||
|  | ||||
|         if (not parsed_args.property | ||||
|                 and not parsed_args.project): | ||||
|             self.app.log.error("No changes requested\n") | ||||
|             self.app.log.error(_("No changes requested\n")) | ||||
|             return | ||||
|  | ||||
|         result = 0 | ||||
| @@ -293,8 +295,8 @@ class UnsetVolumeType(command.Command): | ||||
|             try: | ||||
|                 volume_type.unset_keys(parsed_args.property) | ||||
|             except Exception as e: | ||||
|                 self.app.log.error("Failed to unset volume type property: " + | ||||
|                                    str(e)) | ||||
|                 self.app.log.error(_("Failed to unset volume type property: %s" | ||||
|                                      ) % str(e)) | ||||
|                 result += 1 | ||||
|  | ||||
|         if parsed_args.project: | ||||
| @@ -308,8 +310,8 @@ class UnsetVolumeType(command.Command): | ||||
|                 volume_client.volume_type_access.remove_project_access( | ||||
|                     volume_type.id, project_info.id) | ||||
|             except Exception as e: | ||||
|                 self.app.log.error("Failed to remove volume type access from" | ||||
|                                    " project: " + str(e)) | ||||
|                 self.app.log.error(_("Failed to remove volume type access from" | ||||
|                                    " project: ") + str(e)) | ||||
|                 result += 1 | ||||
|  | ||||
|         if result > 0: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jenkins
					Jenkins