def test_list_container(self, mock_print_list): fake_container = mock.MagicMock() fake_container._info = {} fake_container.addresses = {'private': [{'addr': '10.0.0.1'}]} zun_utils.list_containers([fake_container]) self.assertTrue(mock_print_list.called) self.assertEqual(fake_container.addresses, '10.0.0.1')
def do_list(cs, args): """Print a list of available containers.""" opts = {} opts['all_tenants'] = args.all_tenants opts['marker'] = args.marker opts['limit'] = args.limit opts['sort_key'] = args.sort_key opts['sort_dir'] = args.sort_dir opts = zun_utils.remove_null_parms(**opts) containers = cs.containers.list(**opts) zun_utils.list_containers(containers)
def do_list(cs, args): """Print a list of available containers.""" opts = {} opts['all_projects'] = args.all_projects opts['marker'] = args.marker opts['limit'] = args.limit opts['sort_key'] = args.sort_key opts['sort_dir'] = args.sort_dir opts['image'] = args.image opts['name'] = args.name opts['project_id'] = args.project_id opts['user_id'] = args.user_id opts['host'] = args.host opts['task_state'] = args.task_state opts['memory'] = args.memory opts['auto_remove'] = args.auto_remove opts['status'] = args.status opts = zun_utils.remove_null_parms(**opts) containers = cs.containers.list(**opts) zun_utils.list_containers(containers)