diff options
author | Brian Mattern <rephorm@rephorm.com> | 2014-01-24 20:50:55 -0800 |
---|---|---|
committer | Brian Mattern <rephorm@rephorm.com> | 2014-01-24 20:50:55 -0800 |
commit | 1747dfb7ffe9b91bce7b6e3561ecbc1e0a897a61 (patch) | |
tree | 190b63e94a4a30a0d9fe3eb772986a81408a93af /google-daemon | |
parent | fe5ded4dc13bd83f7162d336ca57ab21aea12cf3 (diff) | |
download | google-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-x | google-daemon/usr/share/google/google_daemon/desired_accounts.py | 4 |
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: |