Ejemplo n.º 1
0
 def do_info( self, line ):
     "Print short info about a VNF or all of them if none is specified."
     vnf_catalog = Catalog().get_db()
     for metadata in vnf_catalog.itervalues():
         try:
             if metadata['name'] == line.strip():
                 for k, v in metadata.iteritems():
                     output('%s: %s\n' % (k, v))
                 break
         except KeyError:
             pass
     else:
         for metadata in vnf_catalog.itervalues():
             try:
                 info = metadata.get('description', '').split('\n')[0]
                 output('%s: %s\n' % (metadata['name'], info))
             except KeyError:
                 pass