From 5b56872e86069695c2b14528d1358e81e5a86467 Mon Sep 17 00:00:00 2001 From: Mateusz Kurek Date: Tue, 23 Sep 2014 10:13:10 +0200 Subject: [PATCH] added openstack tenants to scrooge api --- src/ralph/util/api_scrooge.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ralph/util/api_scrooge.py b/src/ralph/util/api_scrooge.py index 413a906d08..801e74f80f 100644 --- a/src/ralph/util/api_scrooge.py +++ b/src/ralph/util/api_scrooge.py @@ -123,6 +123,23 @@ def get_environments(): } +def get_openstack_tenants(): + for tenant in Device.objects.filter( + sn__startswith='openstack', + model__type=DeviceType.cloud_server + ): + yield { + 'device_id': tenant.id, + 'tenant_id': tenant.sn[len('openstack-'):], + 'service_id': tenant.service_id, + 'environment_id': tenant.device_environment_id, + 'name': tenant.name, + 'model_id': tenant.model_id, + 'model_name': tenant.model.name, + 'remarks': tenant.remarks, + } + + # CMDB def get_business_lines(): """