summaryrefslogtreecommitdiff
path: root/cloudinit/DataSourceEc2.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2010-08-12 12:02:33 -0400
committerScott Moser <smoser@ubuntu.com>2010-08-12 12:02:33 -0400
commit6ffc9647bb18862dbe1d11b5ca370a006916199b (patch)
treee8bb6ffeb731085b536babef7a43eb60b69d355d /cloudinit/DataSourceEc2.py
parent1667516626339f4a7ea91b68696a67c0ea8b7b92 (diff)
downloadvyos-cloud-init-6ffc9647bb18862dbe1d11b5ca370a006916199b.tar.gz
vyos-cloud-init-6ffc9647bb18862dbe1d11b5ca370a006916199b.zip
use read_optional_seed, change 'parse_cmdline_data' to return boolean
using read_optional_seed in DataSourceEc2 and DataSourceNoCloud. change parse_cmdline_data to fill a dictionary that is supplied by caller. It then returns strictly true or false based on whether or not it was specified in cmdline
Diffstat (limited to 'cloudinit/DataSourceEc2.py')
-rw-r--r--cloudinit/DataSourceEc2.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py
index 8a79eb5f..54cbc69c 100644
--- a/cloudinit/DataSourceEc2.py
+++ b/cloudinit/DataSourceEc2.py
@@ -45,17 +45,13 @@ class DataSourceEc2(DataSource.DataSource):
return("DataSourceEc2")
def get_data(self):
- try:
- (md,ud) = util.read_seeded(self.cachedir + "/")
- self.userdata_raw = ud
- self.metadata = md
- cloudinit.log.debug("using seeded ec2 cache data in %s" % self.cachedir)
+ seedret={ }
+ if util.read_optional_seed(seedret,base=self.cachedir + "/"):
+ self.userdata_raw = seedret['user-data']
+ self.metadata = seedret['meta-data']
+ cloudinit.log.debug("using seeded ec2 data in %s" % self.cachedir)
return True
- except OSError, e:
- if e.errno != errno.ENOENT:
- cloudinit.log.warn("unexpected error from preseeded data")
- raise
-
+
try:
if not self.wait_for_metadata_service():
return False