~ubuntu-branches/ubuntu/utopic/horizon/utopic-updates

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/tabs.py

  • Committer: Package Import Robot
  • Author(s): James Page, Chris Johnston, James Page
  • Date: 2014-10-03 17:54:18 UTC
  • mfrom: (0.4.1) (1.1.44) (70.1.2 utopic)
  • Revision ID: package-import@ubuntu.com-20141003175418-1jomx0azdvnl5fxz
Tags: 1:2014.2~rc1-0ubuntu1
[ Chris Johnston ]
* d/theme/css/ubuntu.css: Fix Ubuntu theme for Instances "more" dropdown
  (LP: #1308651).

[ James Page ]
* New upstream release candidate:
  - d/p/*: Refresh.
* d/watch: Use tarballs.openstack.org for upstream releases. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from horizon import exceptions
19
19
from horizon import tabs
20
20
 
 
21
from openstack_dashboard.api import network
21
22
from openstack_dashboard.api import nova
22
23
from openstack_dashboard.api import sahara as saharaclient
23
24
 
46
47
            flavor = {}
47
48
            exceptions.handle(request,
48
49
                              _("Unable to fetch flavor for template."))
49
 
        return {"template": template, "flavor": flavor}
 
50
 
 
51
        floating_ip_pool_name = None
 
52
        if template.floating_ip_pool:
 
53
            try:
 
54
                floating_ip_pool_name = self._get_floating_ip_pool_name(
 
55
                    request, template.floating_ip_pool)
 
56
            except Exception:
 
57
                exceptions.handle(request,
 
58
                                  _("Unable to fetch floating ip pools."))
 
59
 
 
60
        return {"template": template, "flavor": flavor,
 
61
                "floating_ip_pool_name": floating_ip_pool_name}
 
62
 
 
63
    def _get_floating_ip_pool_name(self, request, pool_id):
 
64
        pools = [pool for pool in network.floating_ip_pools_list(
 
65
            request) if pool.id == pool_id]
 
66
 
 
67
        return pools[0].name if pools else pool_id
50
68
 
51
69
 
52
70
class ConfigsTab(tabs.Tab):