The vnf-create and vnfd-create output is hard to read

* The vnf and vnfd create output text contains the "attributes"
    field which is so large that it makes it impossible to format
    the output text so it is readable.

  * Modified the CreateCommand class to provide the ability to
    remove specified fields from the output of the create command

  * Modified the CreateVNF and CreateVNFD classes to specify that
    the "attributes" field should be removed from the output of
    the create command.

Change-Id: I7563175a2cec3e3e9528b66153354aec982a14b4
Closes-Bug: 1474975
This commit is contained in:
Bob HADDLETON
2015-07-18 15:59:34 -05:00
parent cc5e786f08
commit ab13fa3c69
3 changed files with 6 additions and 0 deletions

View File

@@ -412,6 +412,7 @@ class CreateCommand(TackerCommand, show.ShowOne):
api = 'servicevm' api = 'servicevm'
resource = None resource = None
log = None log = None
remove_output_fields = []
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(CreateCommand, self).get_parser(prog_name) parser = super(CreateCommand, self).get_parser(prog_name)
@@ -442,6 +443,9 @@ class CreateCommand(TackerCommand, show.ShowOne):
if info: if info:
print(_('Created a new %s:') % self.resource, print(_('Created a new %s:') % self.resource,
file=self.app.stdout) file=self.app.stdout)
for f in self.remove_output_fields:
if f in info:
info.pop(f)
else: else:
info = {'': ''} info = {'': ''}
return zip(*sorted(info.iteritems())) return zip(*sorted(info.iteritems()))

View File

@@ -42,6 +42,7 @@ class CreateVNF(tackerV10.CreateCommand):
"""create a VNF.""" """create a VNF."""
resource = _VNF resource = _VNF
remove_output_fields = ["attributes"]
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(

View File

@@ -42,6 +42,7 @@ class CreateVNFD(tackerV10.CreateCommand):
"""create a VNFD.""" """create a VNFD."""
resource = _VNFD resource = _VNFD
remove_output_fields = ["attributes"]
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(