summaryrefslogtreecommitdiff
path: root/horizon/api/nova.py
diff options
context:
space:
mode:
Diffstat (limited to 'horizon/api/nova.py')
-rw-r--r--horizon/api/nova.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/horizon/api/nova.py b/horizon/api/nova.py
index c90d75ef..0ad08a2e 100644
--- a/horizon/api/nova.py
+++ b/horizon/api/nova.py
@@ -30,6 +30,7 @@ from novaclient.v1_1.servers import REBOOT_HARD
from horizon.api.base import APIResourceWrapper, APIDictWrapper, url_for
+from django.utils.translation import ugettext as _
LOG = logging.getLogger(__name__)
@@ -166,13 +167,19 @@ class SecurityGroup(APIResourceWrapper):
class SecurityGroupRule(APIResourceWrapper):
""" Wrapper for individual rules in a SecurityGroup. """
- _attrs = ['id', 'ip_protocol', 'from_port', 'to_port', 'ip_range']
+ _attrs = ['id', 'ip_protocol', 'from_port', 'to_port', 'ip_range', 'group']
def __unicode__(self):
- vals = {'from': self.from_port,
- 'to': self.to_port,
- 'cidr': self.ip_range['cidr']}
- return 'ALLOW %(from)s:%(to)s from %(cidr)s' % vals
+ if 'name' in self.group:
+ vals = {'from': self.from_port,
+ 'to': self.to_port,
+ 'group': self.group['name']}
+ return _('ALLOW %(from)s:%(to)s from %(group)s') % vals
+ else:
+ vals = {'from': self.from_port,
+ 'to': self.to_port,
+ 'cidr': self.ip_range['cidr']}
+ return _('ALLOW %(from)s:%(to)s from %(cidr)s') % vals
def novaclient(request):