summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2013-06-05 19:13:06 +0000
committerChris Behrens <cbehrens@codestud.com>2013-06-21 18:58:45 +0000
commit967e9675874fc2a02a585cc6f9b99175f9cd656c (patch)
tree131581c6b0df0a5f07dc6eb6a1b611e192ed1c35 /nova/api
parent022bd8d6c16a1a06a3996f1fa827bc17b4272af7 (diff)
downloadnova-967e9675874fc2a02a585cc6f9b99175f9cd656c.tar.gz
nova-967e9675874fc2a02a585cc6f9b99175f9cd656c.tar.xz
nova-967e9675874fc2a02a585cc6f9b99175f9cd656c.zip
Fix sys_meta access in prep for instance object
Fix various places that access instance['system_metadata'] as if it's a list of sqlalchemy models. A helper util method was created in a previous patch set in nova/utils... so this patch converts things to use it. Left one use in _init_instance() in compute/manager.py because it's being addressed with a different patch set. Related to blueprint unified-object-model Change-Id: I876a6c57f64d61d64069c884bf0414c3596e1aa0
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/metadata/password.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/api/metadata/password.py b/nova/api/metadata/password.py
index 50f6c94ac..793dcc0a7 100644
--- a/nova/api/metadata/password.py
+++ b/nova/api/metadata/password.py
@@ -27,10 +27,10 @@ MAX_SIZE = CHUNKS * CHUNK_LENGTH
def extract_password(instance):
result = ''
- for datum in sorted(instance.get('system_metadata', []),
- key=lambda x: x['key']):
- if datum['key'].startswith('password_'):
- result += datum['value']
+ sys_meta = utils.instance_sys_meta(instance)
+ for key in sorted(sys_meta.keys()):
+ if key.startswith('password_'):
+ result += sys_meta[key]
return result or None