예제 #1
0
 def take_action(self, parsed_args):
     res = list(api.check_dhcp_with_vlans(json.loads(parsed_args.config),
                                          timeout=parsed_args.timeout,
                                          repeat=parsed_args.repeat,
                                          w_vlans=parsed_args.with_vlans))
     if not res:
         res = [{}]
     return (utils.DHCP_OFFER_COLUMNS,
             [utils.get_item_properties(item, utils.DHCP_OFFER_COLUMNS)
              for item in res])
예제 #2
0
파일: commands.py 프로젝트: toby82/fuel-web
 def take_action(self, parsed_args):
     LOG.info('Starting dhcp discover for {0}'.format(parsed_args.ifaces))
     res = list(api.check_dhcp(
         parsed_args.ifaces,
         timeout=parsed_args.timeout,
         repeat=parsed_args.repeat))
     #NOTE(dshulyak) unfortunately cliff doesnt allow to configure
     # PrettyTable output, see link:
     # https://github.com/dhellmann/cliff/blob/master/
     # cliff/formatters/table.py#L34
     # and in case i want always print empty table if nothing found
     # it is not possible by configuration
     if not res:
         res = [{}]
     return (utils.DHCP_OFFER_COLUMNS,
             [utils.get_item_properties(item, utils.DHCP_OFFER_COLUMNS)
              for item in res])
예제 #3
0
 def test_order_preserver(self):
     example = {'first': 'first', 'second': 'second'}
     columns = ['second', 'first']
     items = utils.get_item_properties(example, columns)
     self.assertEqual(columns, items)