diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-30 12:08:36 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-30 12:08:36 +0000 |
| commit | 651637ad5475153ef3f2bc15ff0037aebec414c3 (patch) | |
| tree | 74d8c20b5d196a742f6d57fcfb9d1488f0034322 /nova/api | |
| parent | 37df2052d7b9666c72478de79b46a60b15c9f4fd (diff) | |
| parent | 03ae11664d6d42b02ea2996d0125bcdee87db754 (diff) | |
| download | nova-651637ad5475153ef3f2bc15ff0037aebec414c3.tar.gz nova-651637ad5475153ef3f2bc15ff0037aebec414c3.tar.xz nova-651637ad5475153ef3f2bc15ff0037aebec414c3.zip | |
Merge "Access DB values as dict not as attributes. Part 2"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/security_groups.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/nova/api/openstack/compute/contrib/security_groups.py b/nova/api/openstack/compute/contrib/security_groups.py index c382ce1d5..73f025c4d 100644 --- a/nova/api/openstack/compute/contrib/security_groups.py +++ b/nova/api/openstack/compute/contrib/security_groups.py @@ -181,30 +181,30 @@ class SecurityGroupControllerBase(object): def _format_security_group_rule(self, context, rule): sg_rule = {} - sg_rule['id'] = rule.id - sg_rule['parent_group_id'] = rule.parent_group_id - sg_rule['ip_protocol'] = rule.protocol - sg_rule['from_port'] = rule.from_port - sg_rule['to_port'] = rule.to_port + sg_rule['id'] = rule['id'] + sg_rule['parent_group_id'] = rule['parent_group_id'] + sg_rule['ip_protocol'] = rule['protocol'] + sg_rule['from_port'] = rule['from_port'] + sg_rule['to_port'] = rule['to_port'] sg_rule['group'] = {} sg_rule['ip_range'] = {} - if rule.group_id: + if rule['group_id']: source_group = self.security_group_api.get(context, - id=rule.group_id) + id=rule['group_id']) sg_rule['group'] = {'name': source_group.name, 'tenant_id': source_group.project_id} else: - sg_rule['ip_range'] = {'cidr': rule.cidr} + sg_rule['ip_range'] = {'cidr': rule['cidr']} return sg_rule def _format_security_group(self, context, group): security_group = {} - security_group['id'] = group.id - security_group['description'] = group.description - security_group['name'] = group.name - security_group['tenant_id'] = group.project_id + security_group['id'] = group['id'] + security_group['description'] = group['description'] + security_group['name'] = group['name'] + security_group['tenant_id'] = group['project_id'] security_group['rules'] = [] - for rule in group.rules: + for rule in group['rules']: security_group['rules'] += [self._format_security_group_rule( context, rule)] return security_group |
