summaryrefslogtreecommitdiff
path: root/google-daemon
diff options
context:
space:
mode:
authorBrian Mattern <rephorm@rephorm.com>2014-01-24 20:50:55 -0800
committerBrian Mattern <rephorm@rephorm.com>2014-01-24 20:50:55 -0800
commit1747dfb7ffe9b91bce7b6e3561ecbc1e0a897a61 (patch)
tree190b63e94a4a30a0d9fe3eb772986a81408a93af /google-daemon
parentfe5ded4dc13bd83f7162d336ca57ab21aea12cf3 (diff)
downloadgoogle-compute-image-packages-1747dfb7ffe9b91bce7b6e3561ecbc1e0a897a61.tar.gz
use json.loads instead of ast.literal_eval
It is only a happy coincidence that the json currently returned by the metadata server is also valid python. This is not guaranteed to always be the case.
Diffstat (limited to 'google-daemon')
-rwxr-xr-xgoogle-daemon/usr/share/google/google_daemon/desired_accounts.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/google-daemon/usr/share/google/google_daemon/desired_accounts.py b/google-daemon/usr/share/google/google_daemon/desired_accounts.py
index cbfd26a..98c8a3e 100755
--- a/google-daemon/usr/share/google/google_daemon/desired_accounts.py
+++ b/google-daemon/usr/share/google/google_daemon/desired_accounts.py
@@ -15,7 +15,7 @@
"""Get the accounts desired to be present on the VM."""
-import ast
+import json
import logging
import time
import urllib2
@@ -89,7 +89,7 @@ class DesiredAccounts(object):
etag = response_info.getheader('etag')
attributes_string = response.read()
logging.debug('project attributes: %s', attributes_string)
- attributes = ast.literal_eval(attributes_string)
+ attributes = json.loads(attributes_string)
if attributes and attributes.has_key('sshKeys'):
return True
except (urllib2.URLError, ValueError) as e: