def take_action(self, parsed_args): manager = self.app.client_manager.database databases = manager.databases instance = utils.find_resource(manager.instances, parsed_args.instance) items = databases.list(instance) dbs = items while items.next: items = databases.list(instance, marker=items.next) dbs += items dbs = [osc_utils.get_item_properties(db, self.columns) for db in dbs] return self.columns, dbs
def test_find_by_uuid(self): output = utils.find_resource(self.manager, UUID) self.assertEqual(self.manager.get(UUID), output)
def test_find_by_integer_id(self): output = utils.find_resource(self.manager, 1234) self.assertEqual(self.manager.get('1234'), output)
def test_find_by_str_displayname(self): output = utils.find_resource(self.manager, 'entity_three') self.assertEqual(self.manager.get('4242'), output)
def test_find_by_str_name(self): output = utils.find_resource(self.manager, 'entity_one') self.assertEqual(self.manager.get('1234'), output)
def _find_cluster(cs, cluster): """Get a cluster by ID.""" return utils.find_resource(cs.clusters, cluster)
def _find_backup(cs, backup): """Get a backup by ID.""" return utils.find_resource(cs.backups, backup)
def _find_flavor(cs, flavor): """Get a flavor by ID.""" return utils.find_resource(cs.flavors, flavor)
def _find_instance(cs, instance): """Get an instance by ID.""" return utils.find_resource(cs.instances, instance)
def test_find_by_str_id(self): output = utils.find_resource(self.manager, '1234') self.assertEqual(output, self.manager.get('1234'))
def test_find_by_int_name(self): output = utils.find_resource(self.manager, 9876) self.assertEqual(self.manager.get('5678'), output)