Ejemplo n.º 1
0
 def test_get_all_http_servers(self):
     kwargs = {
         'user_id': 'a-fake-user-0',
         'tenant_id': self.project_id,
     }
     admin_context = self.context.elevated(read_deleted='no')
     self.mox.StubOutWithMock(db, 'load_balancer_domain_get_all')
     self.mox.StubOutWithMock(self.context, 'elevated')
     self.context.elevated(read_deleted='no').AndReturn(admin_context)
     db.load_balancer_domain_get_all(
         admin_context).AndReturn(self.all_domains)
     self.mox.ReplayAll()
     r = api.get_all_http_servers(self.context, **kwargs)
     self.mox.VerifyAll()
     self.assertEqual(r, {'data': self.http_server_names})
Ejemplo n.º 2
0
def get_all_http_servers(context, **kwargs):
    expect_keys = [
        'user_id', 'tenant_id',
    ]
    utils.check_input_parameters(expect_keys, **kwargs)

    result = None
    try:
        context = context.elevated(read_deleted='no')
        all_domains = db.load_balancer_domain_get_all(context)
        result = map(lambda x: x['name'], all_domains)
    except Exception, exp:
        raise exception.GetAllHttpServersFailed(msg=str(exp))
Ejemplo n.º 3
0
def get_all_domain_names():
    ctxt = context.get_admin_context()
    all_domains = db.load_balancer_domain_get_all(ctxt)
    all_http_servers = map(lambda x: x['name'], all_domains)
    return all_http_servers