Skip to content

Commit

Permalink
added openstack tenants to scrooge api
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurek committed Sep 23, 2014
1 parent ff8d288 commit 5b56872
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/ralph/util/api_scrooge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
"""
Expand Down

0 comments on commit 5b56872

Please sign in to comment.