summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-09-15 12:01:08 +0200
committerSoren Hansen <soren.hansen@rackspace.com>2010-09-15 12:01:08 +0200
commitfaebe1ecd4aec4e2050a12f191266beadc468134 (patch)
treefd944e24f73b85a0b7b36c3a2aacdcf2442d42d6
parent587b21cc00919cc29e2f815fc9de3e3ad6e6fa30 (diff)
downloadnova-faebe1ecd4aec4e2050a12f191266beadc468134.tar.gz
nova-faebe1ecd4aec4e2050a12f191266beadc468134.tar.xz
nova-faebe1ecd4aec4e2050a12f191266beadc468134.zip
Clean up use of objects coming out of the ORM.
-rw-r--r--nova/auth/manager.py12
-rwxr-xr-xnova/endpoint/api.py1
-rw-r--r--nova/endpoint/cloud.py18
3 files changed, 15 insertions, 16 deletions
diff --git a/nova/auth/manager.py b/nova/auth/manager.py
index 5529515a6..c4f964b80 100644
--- a/nova/auth/manager.py
+++ b/nova/auth/manager.py
@@ -531,11 +531,11 @@ class AuthManager(object):
except:
drv.delete_project(project.id)
raise
-
- values = {'name': 'default',
- 'description': 'default',
- 'user_id': User.safe_id(manager_user),
- 'project_id': project.id}
+
+ values = { 'name' : 'default',
+ 'description' : 'default',
+ 'user_id' : User.safe_id(manager_user),
+ 'project_id' : project['id'] }
db.security_group_create({}, values)
return project
@@ -597,7 +597,7 @@ class AuthManager(object):
groups = db.security_group_get_by_project(context={},
project_id=project_id)
for group in groups:
- db.security_group_destroy({}, group.id)
+ db.security_group_destroy({}, group['id'])
except:
logging.exception('Could not destroy security groups for %s',
project)
diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py
index 1f37aeb02..40be00bb7 100755
--- a/nova/endpoint/api.py
+++ b/nova/endpoint/api.py
@@ -135,7 +135,6 @@ class APIRequest(object):
response = xml.toxml()
xml.unlink()
-# print response
_log.debug(response)
return response
diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py
index fc83a9d1c..0289de285 100644
--- a/nova/endpoint/cloud.py
+++ b/nova/endpoint/cloud.py
@@ -93,7 +93,7 @@ class CloudController(object):
result[instance['key_name']] = [line]
return result
- def _refresh_security_group(self, security_group):
+ def _trigger_refresh_security_group(self, security_group):
nodes = set([instance.host for instance in security_group.instances])
for node in nodes:
rpc.call('%s.%s' % (FLAGS.compute_topic, node),
@@ -227,7 +227,7 @@ class CloudController(object):
groups = db.security_group_get_all(context)
else:
groups = db.security_group_get_by_project(context,
- context.project.id)
+ context.project['id'])
groups = [self._format_security_group(context, g) for g in groups]
if not group_name is None:
groups = [g for g in groups if g.name in group_name]
@@ -265,7 +265,7 @@ class CloudController(object):
source_security_group_name=None,
source_security_group_owner_id=None):
security_group = db.security_group_get_by_name(context,
- context.project.id,
+ context.project['id'],
group_name)
criteria = {}
@@ -301,12 +301,12 @@ class CloudController(object):
# If we make it here, we have a match
db.security_group_rule_destroy(context, rule.id)
- self._refresh_security_group(security_group)
+ self._trigger_refresh_security_group(security_group)
return True
# TODO(soren): Lots and lots of input validation. We're accepting
- # strings here (such as ipProtocol), which is put into
+ # strings here (such as ipProtocol), which are put into
# filter rules verbatim.
# TODO(soren): Dupe detection. Adding the same rule twice actually
# adds the same rule twice to the rule set, which is
@@ -324,7 +324,7 @@ class CloudController(object):
source_security_group_name=None,
source_security_group_owner_id=None):
security_group = db.security_group_get_by_name(context,
- context.project.id,
+ context.project['id'],
group_name)
values = { 'parent_group' : security_group }
@@ -366,11 +366,11 @@ class CloudController(object):
# Since we're looking up by project name, the user name is not
# used here. It's only read for EC2 API compatibility.
if len(source_parts) == 2:
- source_project_id = parts[1]
+ source_project_id = source_parts[1]
else:
- source_project_id = parts[0]
+ source_project_id = source_parts[0]
else:
- source_project_id = context.project.id
+ source_project_id = context.project['id']
return source_project_id