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:
@@ -328,10 +328,10 @@ class TackerShell(app.App):
|
|||||||
'--os-project-name',
|
'--os-project-name',
|
||||||
metavar='<auth-project-name>',
|
metavar='<auth-project-name>',
|
||||||
default=utils.env('OS_PROJECT_NAME'),
|
default=utils.env('OS_PROJECT_NAME'),
|
||||||
help='Another way to specify tenant name. '
|
help=_('Another way to specify tenant name. '
|
||||||
'This option is mutually exclusive with '
|
'This option is mutually exclusive with '
|
||||||
' --os-tenant-name. '
|
' --os-tenant-name. '
|
||||||
'Defaults to env[OS_PROJECT_NAME].')
|
'Defaults to env[OS_PROJECT_NAME].'))
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--os_tenant_name',
|
'--os_tenant_name',
|
||||||
@@ -347,10 +347,10 @@ class TackerShell(app.App):
|
|||||||
'--os-project-id',
|
'--os-project-id',
|
||||||
metavar='<auth-project-id>',
|
metavar='<auth-project-id>',
|
||||||
default=utils.env('OS_PROJECT_ID'),
|
default=utils.env('OS_PROJECT_ID'),
|
||||||
help='Another way to specify tenant ID. '
|
help=_('Another way to specify tenant ID. '
|
||||||
'This option is mutually exclusive with '
|
'This option is mutually exclusive with '
|
||||||
' --os-tenant-id. '
|
' --os-tenant-id. '
|
||||||
'Defaults to env[OS_PROJECT_ID].')
|
'Defaults to env[OS_PROJECT_ID].'))
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--os-username', metavar='<auth-username>',
|
'--os-username', metavar='<auth-username>',
|
||||||
@@ -373,8 +373,8 @@ class TackerShell(app.App):
|
|||||||
'--os-user-domain-id',
|
'--os-user-domain-id',
|
||||||
metavar='<auth-user-domain-id>',
|
metavar='<auth-user-domain-id>',
|
||||||
default=utils.env('OS_USER_DOMAIN_ID'),
|
default=utils.env('OS_USER_DOMAIN_ID'),
|
||||||
help='OpenStack user domain ID. '
|
help=_('OpenStack user domain ID. '
|
||||||
'Defaults to env[OS_USER_DOMAIN_ID].')
|
'Defaults to env[OS_USER_DOMAIN_ID].'))
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--os_user_domain_id',
|
'--os_user_domain_id',
|
||||||
@@ -384,8 +384,8 @@ class TackerShell(app.App):
|
|||||||
'--os-user-domain-name',
|
'--os-user-domain-name',
|
||||||
metavar='<auth-user-domain-name>',
|
metavar='<auth-user-domain-name>',
|
||||||
default=utils.env('OS_USER_DOMAIN_NAME'),
|
default=utils.env('OS_USER_DOMAIN_NAME'),
|
||||||
help='OpenStack user domain name. '
|
help=_('OpenStack user domain name. '
|
||||||
'Defaults to env[OS_USER_DOMAIN_NAME].')
|
'Defaults to env[OS_USER_DOMAIN_NAME].'))
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--os_user_domain_name',
|
'--os_user_domain_name',
|
||||||
@@ -403,13 +403,13 @@ class TackerShell(app.App):
|
|||||||
'--os-project-domain-id',
|
'--os-project-domain-id',
|
||||||
metavar='<auth-project-domain-id>',
|
metavar='<auth-project-domain-id>',
|
||||||
default=utils.env('OS_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(
|
parser.add_argument(
|
||||||
'--os-project-domain-name',
|
'--os-project-domain-name',
|
||||||
metavar='<auth-project-domain-name>',
|
metavar='<auth-project-domain-name>',
|
||||||
default=utils.env('OS_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(
|
parser.add_argument(
|
||||||
'--os-cert',
|
'--os-cert',
|
||||||
|
@@ -19,6 +19,7 @@ import yaml
|
|||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
|
from tackerclient.i18n import _
|
||||||
from tackerclient.tacker import v1_0 as tackerV10
|
from tackerclient.tacker import v1_0 as tackerV10
|
||||||
from tackerclient.tacker.v1_0.nfvo import vim_utils
|
from tackerclient.tacker.v1_0.nfvo import vim_utils
|
||||||
|
|
||||||
@@ -48,18 +49,18 @@ class CreateVIM(tackerV10.CreateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--config-file',
|
'--config-file',
|
||||||
required=True,
|
required=True,
|
||||||
help='YAML file with VIM configuration parameters')
|
help=_('YAML file with VIM configuration parameters'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'name', metavar='NAME',
|
'name', metavar='NAME',
|
||||||
help='Set a name for the VIM')
|
help=_('Set a name for the VIM'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
help='Set a description for the VIM')
|
help=_('Set a description for the VIM'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--is-default',
|
'--is-default',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help='Set as default VIM')
|
help=_('Set as default VIM'))
|
||||||
|
|
||||||
def args2body(self, parsed_args):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
@@ -92,18 +93,18 @@ class UpdateVIM(tackerV10.UpdateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--config-file',
|
'--config-file',
|
||||||
required=True,
|
required=True,
|
||||||
help='YAML file with VIM configuration parameters')
|
help=_('YAML file with VIM configuration parameters'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--name',
|
'--name',
|
||||||
help='New name for the VIM')
|
help=_('New name for the VIM'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
help='New description for the VIM')
|
help=_('New description for the VIM'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--is-default',
|
'--is-default',
|
||||||
type=strutils.bool_from_string,
|
type=strutils.bool_from_string,
|
||||||
metavar='{True,False}',
|
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):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from tackerclient.i18n import _
|
||||||
from tackerclient.tacker import v1_0 as tackerV10
|
from tackerclient.tacker import v1_0 as tackerV10
|
||||||
|
|
||||||
|
|
||||||
@@ -80,21 +81,21 @@ class CreateVNFFG(tackerV10.CreateCommand):
|
|||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'name', metavar='NAME',
|
'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 = parser.add_mutually_exclusive_group(required=True)
|
||||||
vnffgd_group.add_argument(
|
vnffgd_group.add_argument(
|
||||||
'--vnffgd-id',
|
'--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_group.add_argument(
|
||||||
'--vnffgd-name',
|
'--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(
|
parser.add_argument(
|
||||||
'--vnf-mapping',
|
'--vnf-mapping',
|
||||||
help='List of logical VNFD name to VNF instance name mapping. '
|
help=_('List of logical VNFD name to VNF instance name mapping. '
|
||||||
'Example: VNF1:my_vnf1,VNF2:my_vnf2')
|
'Example: VNF1:my_vnf1,VNF2:my_vnf2'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--symmetrical', metavar='{True,False}',
|
'--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):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
@@ -134,11 +135,11 @@ class UpdateVNFFG(tackerV10.UpdateCommand):
|
|||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--vnf-mapping',
|
'--vnf-mapping',
|
||||||
help='List of logical VNFD name to VNF instance name mapping. '
|
help=_('List of logical VNFD name to VNF instance name mapping. '
|
||||||
'Example: VNF1:my_vnf1,VNF2:my_vnf2')
|
'Example: VNF1:my_vnf1,VNF2:my_vnf2'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--symmetrical', metavar='{True,False}',
|
'--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):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
|
@@ -42,14 +42,14 @@ class CreateVNFFGD(tackerV10.CreateCommand):
|
|||||||
|
|
||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
group.add_argument('--vnffgd-file', help='Specify VNFFGD file')
|
group.add_argument('--vnffgd-file', help=_('Specify VNFFGD file'))
|
||||||
group.add_argument('--vnffgd', help='Specify VNFFGD')
|
group.add_argument('--vnffgd', help=_('Specify VNFFGD'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'name', metavar='NAME',
|
'name', metavar='NAME',
|
||||||
help='Set a name for the VNFFGD')
|
help=_('Set a name for the VNFFGD'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
help='Set a description for the VNFFGD')
|
help=_('Set a description for the VNFFGD'))
|
||||||
|
|
||||||
def args2body(self, parsed_args):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
|
@@ -49,37 +49,36 @@ class CreateVNF(tackerV10.CreateCommand):
|
|||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'name', metavar='NAME',
|
'name', metavar='NAME',
|
||||||
help='Set a name for the VNF')
|
help=_('Set a name for the VNF'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
help='Set description for the VNF')
|
help=_('Set description for the VNF'))
|
||||||
vnfd_group = parser.add_mutually_exclusive_group(required=True)
|
vnfd_group = parser.add_mutually_exclusive_group(required=True)
|
||||||
vnfd_group.add_argument(
|
vnfd_group.add_argument(
|
||||||
'--vnfd-id',
|
'--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_group.add_argument(
|
||||||
'--vnfd-name',
|
'--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 = parser.add_mutually_exclusive_group()
|
||||||
vim_group.add_argument(
|
vim_group.add_argument(
|
||||||
'--vim-id',
|
'--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_group.add_argument(
|
||||||
'--vim-name',
|
'--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(
|
parser.add_argument(
|
||||||
'--vim-region-name',
|
'--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(
|
parser.add_argument(
|
||||||
'--config-file',
|
'--config-file',
|
||||||
help='YAML file with VNF configuration')
|
help=_('YAML file with VNF configuration'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--config',
|
'--config',
|
||||||
help='Specify config yaml data')
|
help=_('Specify config yaml data'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--param-file',
|
'--param-file',
|
||||||
help='Specify parameter yaml file'
|
help=_('Specify parameter yaml file'))
|
||||||
)
|
|
||||||
|
|
||||||
def args2body(self, parsed_args):
|
def args2body(self, parsed_args):
|
||||||
args = {'attributes': {}}
|
args = {'attributes': {}}
|
||||||
@@ -138,10 +137,10 @@ class UpdateVNF(tackerV10.UpdateCommand):
|
|||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--config-file',
|
'--config-file',
|
||||||
help='YAML file with VNF configuration')
|
help=_('YAML file with VNF configuration'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--config',
|
'--config',
|
||||||
help='Specify config yaml data')
|
help=_('Specify config yaml data'))
|
||||||
|
|
||||||
def args2body(self, parsed_args):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
@@ -262,16 +261,16 @@ class ScaleVNF(tackerV10.TackerCommand):
|
|||||||
vnf_group = parser.add_mutually_exclusive_group(required=True)
|
vnf_group = parser.add_mutually_exclusive_group(required=True)
|
||||||
vnf_group.add_argument(
|
vnf_group.add_argument(
|
||||||
'--vnf-id',
|
'--vnf-id',
|
||||||
help='VNF ID')
|
help=_('VNF ID'))
|
||||||
vnf_group.add_argument(
|
vnf_group.add_argument(
|
||||||
'--vnf-name',
|
'--vnf-name',
|
||||||
help='VNF name')
|
help=_('VNF name'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--scaling-policy-name',
|
'--scaling-policy-name',
|
||||||
help='VNF policy name used to scale')
|
help=_('VNF policy name used to scale'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--scaling-type',
|
'--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):
|
def args2body(self, parsed_args):
|
||||||
args = {}
|
args = {}
|
||||||
|
@@ -49,14 +49,14 @@ class CreateVNFD(tackerV10.CreateCommand):
|
|||||||
|
|
||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
group.add_argument('--vnfd-file', help='Specify VNFD file')
|
group.add_argument('--vnfd-file', help=_('Specify VNFD file'))
|
||||||
group.add_argument('--vnfd', help='Specify VNFD')
|
group.add_argument('--vnfd', help=_('Specify VNFD'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'name', metavar='NAME',
|
'name', metavar='NAME',
|
||||||
help='Set a name for the VNFD')
|
help=_('Set a name for the VNFD'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
help='Set a description for the VNFD')
|
help=_('Set a description for the VNFD'))
|
||||||
|
|
||||||
def args2body(self, parsed_args):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
|
Reference in New Issue
Block a user