def get_active_allocations(): auth_session = get_auth_session() aclient = allocation_client.Client('1', session=auth_session) active_allocations = {} # All approved allocations allocations = aclient.allocations.list(parent_request__isnull=True) for allocation in allocations: if (allocation.status == states.DELETED or allocation.status == states.SUBMITTED): continue elif allocation.status != states.APPROVED: try: allocation = aclient.allocations.get_last_approved( parent_request=allocation.id) except exceptions.AllocationDoesNotExist: continue if not allocation.project_id: continue active_allocations[allocation.project_id] = allocation return active_allocations
def get_active_allocations(): auth_session = get_auth_session() aclient = allocation_client.Client('1', session=auth_session) active_allocations = {} # All approved allocations allocations = aclient.allocations.list(parent_request__isnull=True) for allocation in allocations: if (allocation.status == states.DELETED or allocation.status == states.SUBMITTED): continue elif allocation.status != states.APPROVED: try: allocation = aclient.allocations.get_last_approved( parent_request=allocation.id) except exceptions.AllocationDoesNotExist: continue if not allocation.project_id: continue active_allocations[allocation.project_id] = allocation.allocation_home return active_allocations
def report_metrics(sender, from_time, to_time): session = keystone.get_auth_session() client = manuka_client.Client('1', session=session) while from_time < to_time: now = int(from_time.strftime("%s")) users = list(list_users(client, from_time)) count(sender, users, now) by_idp(sender, users, now) from_time = from_time + timedelta(hours=1) sender.flush()
def client(): auth_session = get_auth_session() return nova_client.Client(NOVA_VERSION, session=auth_session)
def get_client(): auth = keystone.get_auth_session() return client.Client(GNOCCHI_API_VERSION, auth)
def client(): auth_session = get_auth_session() return nova_client.Client(NOVA_VERSION, session=auth_session)
def client(): auth_session = keystone.get_auth_session() return cinder_client.Client('2', session=auth_session)
def _get_client(): auth = keystone.get_auth_session() return client.Client(GNOCCHI_API_VERSION, auth)
def client(): auth_session = keystone.get_auth_session() return cinder_client.Client('3', session=auth_session)