Fix ext-show command error

Currently ext-show command can not be ran correctly, because
there are duplicated arguments added to command options.

Change-Id: I36fdb3608f9976c633902bba04d61c3cd63b1b39
Closes-bug: #1595036
This commit is contained in:
xu-haiwei 2016-06-22 13:28:12 +09:00
parent f42187050f
commit a5ad0bc3d3
2 changed files with 7 additions and 9 deletions

View File

@ -649,6 +649,10 @@ class ShowCommand(TackerCommand, show.ShowOne):
log = None
allow_names = True
def get_id(self):
if self.resource:
return self.resource.upper()
def get_parser(self, prog_name):
parser = super(ShowCommand, self).get_parser(prog_name)
add_show_list_common_argument(parser)
@ -657,7 +661,7 @@ class ShowCommand(TackerCommand, show.ShowOne):
else:
help_str = _('ID of %s to look up')
parser.add_argument(
'id', metavar=self.resource.upper(),
'id', metavar=self.get_id(),
help=help_str % self.resource)
return parser

View File

@ -14,7 +14,6 @@
# under the License.
#
from tackerclient.common._i18n import _
from tackerclient.tacker import v1_0 as cmd_base
@ -31,10 +30,5 @@ class ShowExt(cmd_base.ShowCommand):
resource = "extension"
allow_names = False
def get_parser(self, prog_name):
parser = super(ShowExt, self).get_parser(prog_name)
cmd_base.add_show_list_common_argument(parser)
parser.add_argument(
'id', metavar='EXT-ALIAS',
help=_('The extension alias'))
return parser
def get_id(self):
return 'EXT-ALIAS'