Fix oslo.i18n problems in python-tackerclient

Help msg in tacker project should support oslo.i18n. But
tests directory faces developer, So it needn't support oslo.i18n.

Co-Authored-By: ShuYingya<yingya.shu@easystack.cn>
Change-Id: I60106b106cfd77b46663ff35a2735cfa5ea158f0
This commit is contained in:
Lu lei 2016-08-15 13:47:12 +08:00 committed by Shu Yingya
parent f673cea49c
commit ef1585a024
6 changed files with 57 additions and 56 deletions

View File

@ -328,10 +328,10 @@ class TackerShell(app.App):
'--os-project-name',
metavar='<auth-project-name>',
default=utils.env('OS_PROJECT_NAME'),
help='Another way to specify tenant name. '
'This option is mutually exclusive with '
' --os-tenant-name. '
'Defaults to env[OS_PROJECT_NAME].')
help=_('Another way to specify tenant name. '
'This option is mutually exclusive with '
' --os-tenant-name. '
'Defaults to env[OS_PROJECT_NAME].'))
parser.add_argument(
'--os_tenant_name',
@ -347,10 +347,10 @@ class TackerShell(app.App):
'--os-project-id',
metavar='<auth-project-id>',
default=utils.env('OS_PROJECT_ID'),
help='Another way to specify tenant ID. '
'This option is mutually exclusive with '
' --os-tenant-id. '
'Defaults to env[OS_PROJECT_ID].')
help=_('Another way to specify tenant ID. '
'This option is mutually exclusive with '
' --os-tenant-id. '
'Defaults to env[OS_PROJECT_ID].'))
parser.add_argument(
'--os-username', metavar='<auth-username>',
@ -373,8 +373,8 @@ class TackerShell(app.App):
'--os-user-domain-id',
metavar='<auth-user-domain-id>',
default=utils.env('OS_USER_DOMAIN_ID'),
help='OpenStack user domain ID. '
'Defaults to env[OS_USER_DOMAIN_ID].')
help=_('OpenStack user domain ID. '
'Defaults to env[OS_USER_DOMAIN_ID].'))
parser.add_argument(
'--os_user_domain_id',
@ -384,8 +384,8 @@ class TackerShell(app.App):
'--os-user-domain-name',
metavar='<auth-user-domain-name>',
default=utils.env('OS_USER_DOMAIN_NAME'),
help='OpenStack user domain name. '
'Defaults to env[OS_USER_DOMAIN_NAME].')
help=_('OpenStack user domain name. '
'Defaults to env[OS_USER_DOMAIN_NAME].'))
parser.add_argument(
'--os_user_domain_name',
@ -403,13 +403,13 @@ class TackerShell(app.App):
'--os-project-domain-id',
metavar='<auth-project-domain-id>',
default=utils.env('OS_PROJECT_DOMAIN_ID'),
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=utils.env('OS_PROJECT_DOMAIN_NAME'),
help='Defaults to env[OS_PROJECT_DOMAIN_NAME].')
help=_('Defaults to env[OS_PROJECT_DOMAIN_NAME].'))
parser.add_argument(
'--os-cert',

View File

@ -19,6 +19,7 @@ import yaml
from oslo_utils import strutils
from tackerclient.common import exceptions
from tackerclient.i18n import _
from tackerclient.tacker import v1_0 as tackerV10
from tackerclient.tacker.v1_0.nfvo import vim_utils
@ -48,18 +49,18 @@ class CreateVIM(tackerV10.CreateCommand):
parser.add_argument(
'--config-file',
required=True,
help='YAML file with VIM configuration parameters')
help=_('YAML file with VIM configuration parameters'))
parser.add_argument(
'name', metavar='NAME',
help='Set a name for the VIM')
help=_('Set a name for the VIM'))
parser.add_argument(
'--description',
help='Set a description for the VIM')
help=_('Set a description for the VIM'))
parser.add_argument(
'--is-default',
action='store_true',
default=False,
help='Set as default VIM')
help=_('Set as default VIM'))
def args2body(self, parsed_args):
body = {self.resource: {}}
@ -92,18 +93,18 @@ class UpdateVIM(tackerV10.UpdateCommand):
parser.add_argument(
'--config-file',
required=True,
help='YAML file with VIM configuration parameters')
help=_('YAML file with VIM configuration parameters'))
parser.add_argument(
'--name',
help='New name for the VIM')
help=_('New name for the VIM'))
parser.add_argument(
'--description',
help='New description for the VIM')
help=_('New description for the VIM'))
parser.add_argument(
'--is-default',
type=strutils.bool_from_string,
metavar='{True,False}',
help='Indicate whether the VIM is used as default')
help=_('Indicate whether the VIM is used as default'))
def args2body(self, parsed_args):
body = {self.resource: {}}

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tackerclient.i18n import _
from tackerclient.tacker import v1_0 as tackerV10
@ -80,21 +81,21 @@ class CreateVNFFG(tackerV10.CreateCommand):
def add_known_arguments(self, parser):
parser.add_argument(
'name', metavar='NAME',
help='Set a name for the VNFFG')
help=_('Set a name for the VNFFG'))
vnffgd_group = parser.add_mutually_exclusive_group(required=True)
vnffgd_group.add_argument(
'--vnffgd-id',
help='VNFFGD ID to use as template to create VNFFG')
help=_('VNFFGD ID to use as template to create VNFFG'))
vnffgd_group.add_argument(
'--vnffgd-name',
help='VNFFGD Name to use as template to create VNFFG')
help=_('VNFFGD Name to use as template to create VNFFG'))
parser.add_argument(
'--vnf-mapping',
help='List of logical VNFD name to VNF instance name mapping. '
'Example: VNF1:my_vnf1,VNF2:my_vnf2')
help=_('List of logical VNFD name to VNF instance name mapping. '
'Example: VNF1:my_vnf1,VNF2:my_vnf2'))
parser.add_argument(
'--symmetrical', metavar='{True,False}',
help='Should a reverse path be created for the NFP')
help=_('Should a reverse path be created for the NFP'))
def args2body(self, parsed_args):
body = {self.resource: {}}
@ -134,11 +135,11 @@ class UpdateVNFFG(tackerV10.UpdateCommand):
def add_known_arguments(self, parser):
parser.add_argument(
'--vnf-mapping',
help='List of logical VNFD name to VNF instance name mapping. '
'Example: VNF1:my_vnf1,VNF2:my_vnf2')
help=_('List of logical VNFD name to VNF instance name mapping. '
'Example: VNF1:my_vnf1,VNF2:my_vnf2'))
parser.add_argument(
'--symmetrical', metavar='{True,False}',
help='Should a reverse path be created for the NFP')
help=_('Should a reverse path be created for the NFP'))
def args2body(self, parsed_args):
body = {self.resource: {}}

View File

@ -42,14 +42,14 @@ class CreateVNFFGD(tackerV10.CreateCommand):
def add_known_arguments(self, parser):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--vnffgd-file', help='Specify VNFFGD file')
group.add_argument('--vnffgd', help='Specify VNFFGD')
group.add_argument('--vnffgd-file', help=_('Specify VNFFGD file'))
group.add_argument('--vnffgd', help=_('Specify VNFFGD'))
parser.add_argument(
'name', metavar='NAME',
help='Set a name for the VNFFGD')
help=_('Set a name for the VNFFGD'))
parser.add_argument(
'--description',
help='Set a description for the VNFFGD')
help=_('Set a description for the VNFFGD'))
def args2body(self, parsed_args):
body = {self.resource: {}}

View File

@ -49,37 +49,36 @@ class CreateVNF(tackerV10.CreateCommand):
def add_known_arguments(self, parser):
parser.add_argument(
'name', metavar='NAME',
help='Set a name for the VNF')
help=_('Set a name for the VNF'))
parser.add_argument(
'--description',
help='Set description for the VNF')
help=_('Set description for the VNF'))
vnfd_group = parser.add_mutually_exclusive_group(required=True)
vnfd_group.add_argument(
'--vnfd-id',
help='VNFD ID to use as template to create VNF')
help=_('VNFD ID to use as template to create VNF'))
vnfd_group.add_argument(
'--vnfd-name',
help='VNFD Name to use as template to create VNF')
help=_('VNFD Name to use as template to create VNF'))
vim_group = parser.add_mutually_exclusive_group()
vim_group.add_argument(
'--vim-id',
help='VIM ID to use to create VNF on the specified VIM')
help=_('VIM ID to use to create VNF on the specified VIM'))
vim_group.add_argument(
'--vim-name',
help='VIM name to use to create VNF on the specified VIM')
help=_('VIM name to use to create VNF on the specified VIM'))
parser.add_argument(
'--vim-region-name',
help='VIM Region to use to create VNF on the specified VIM')
help=_('VIM Region to use to create VNF on the specified VIM'))
parser.add_argument(
'--config-file',
help='YAML file with VNF configuration')
help=_('YAML file with VNF configuration'))
parser.add_argument(
'--config',
help='Specify config yaml data')
help=_('Specify config yaml data'))
parser.add_argument(
'--param-file',
help='Specify parameter yaml file'
)
help=_('Specify parameter yaml file'))
def args2body(self, parsed_args):
args = {'attributes': {}}
@ -138,10 +137,10 @@ class UpdateVNF(tackerV10.UpdateCommand):
def add_known_arguments(self, parser):
parser.add_argument(
'--config-file',
help='YAML file with VNF configuration')
help=_('YAML file with VNF configuration'))
parser.add_argument(
'--config',
help='Specify config yaml data')
help=_('Specify config yaml data'))
def args2body(self, parsed_args):
body = {self.resource: {}}
@ -262,16 +261,16 @@ class ScaleVNF(tackerV10.TackerCommand):
vnf_group = parser.add_mutually_exclusive_group(required=True)
vnf_group.add_argument(
'--vnf-id',
help='VNF ID')
help=_('VNF ID'))
vnf_group.add_argument(
'--vnf-name',
help='VNF name')
help=_('VNF name'))
parser.add_argument(
'--scaling-policy-name',
help='VNF policy name used to scale')
help=_('VNF policy name used to scale'))
parser.add_argument(
'--scaling-type',
help='VNF scaling type, it could be either "out" or "in"')
help=_('VNF scaling type, it could be either "out" or "in"'))
def args2body(self, parsed_args):
args = {}

View File

@ -49,14 +49,14 @@ class CreateVNFD(tackerV10.CreateCommand):
def add_known_arguments(self, parser):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--vnfd-file', help='Specify VNFD file')
group.add_argument('--vnfd', help='Specify VNFD')
group.add_argument('--vnfd-file', help=_('Specify VNFD file'))
group.add_argument('--vnfd', help=_('Specify VNFD'))
parser.add_argument(
'name', metavar='NAME',
help='Set a name for the VNFD')
help=_('Set a name for the VNFD'))
parser.add_argument(
'--description',
help='Set a description for the VNFD')
help=_('Set a description for the VNFD'))
def args2body(self, parsed_args):
body = {self.resource: {}}