components/openstack/horizon/patches/10-network-agents.patch
changeset 3998 5bd484384122
parent 3997 0ca3f3d6c919
child 4002 95b8f35fcdd5
equal deleted inserted replaced
3997:0ca3f3d6c919 3998:5bd484384122
     1 In-house patch to handle Resource Not Found exception while trying
       
     2 to display the Network Agents panel. This is needed as our Neutron
       
     3 doesn't support Agents extension.
       
     4 
       
     5 --- horizon-2013.2.3/openstack_dashboard/api/neutron.py	2014-04-03 11:45:53.000000000 -0700
       
     6 +++ NEW/openstack_dashboard/api/neutron.py	2014-07-08 09:35:42.219185826 -0700
       
     7 @@ -33,6 +33,7 @@
       
     8  from openstack_dashboard.api import network_base
       
     9  from openstack_dashboard.api import nova
       
    10  
       
    11 +from neutronclient.common.exceptions import NeutronClientException
       
    12  from neutronclient.v2_0 import client as neutron_client
       
    13  
       
    14  LOG = logging.getLogger(__name__)
       
    15 @@ -718,7 +719,11 @@
       
    16  
       
    17  
       
    18  def agent_list(request):
       
    19 -    agents = neutronclient(request).list_agents()
       
    20 +    try:
       
    21 +        agents = neutronclient(request).list_agents()
       
    22 +    except NeutronClientException as nce:
       
    23 +        if nce.status_code == 404:
       
    24 +            return []
       
    25      return [Agent(a) for a in agents['agents']]
       
    26  
       
    27