From 6ffc9647bb18862dbe1d11b5ca370a006916199b Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 12 Aug 2010 12:02:33 -0400 Subject: 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 --- cloudinit/DataSourceEc2.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'cloudinit/DataSourceEc2.py') 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 -- cgit v1.2.3