From 85444c68c8728d4324b71218d15d4f04ecdb4fbd Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 31 Jan 2011 16:40:43 -0500 Subject: replace DataSource's self.log After adding the 'log' element to the DataSource class, pickling would fail with TypeError: can't pickle file objects Instead of having the object with a log reference, use one from 'DataSource.log' and have that set by cloudinit --- cloudinit/DataSourceNoCloud.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cloudinit/DataSourceNoCloud.py') diff --git a/cloudinit/DataSourceNoCloud.py b/cloudinit/DataSourceNoCloud.py index 4cbbeded..5aebb50f 100644 --- a/cloudinit/DataSourceNoCloud.py +++ b/cloudinit/DataSourceNoCloud.py @@ -17,6 +17,7 @@ # along with this program. If not, see . import DataSource +log = DataSource.log from cloudinit import seeddir import cloudinit.util as util @@ -54,7 +55,7 @@ class DataSourceNoCloud(DataSource.DataSource): if parse_cmdline_data(self.cmdline_id, md): found.append("cmdline") except: - util.logexc(self.log,util.WARN) + util.logexc(log) return False # check to see if the seeddir has data. @@ -63,7 +64,7 @@ class DataSourceNoCloud(DataSource.DataSource): md = util.mergedict(md,seedret['meta-data']) ud = seedret['user-data'] found.append(self.seeddir) - self.log.debug("using seeded cache data in %s" % self.seeddir) + log.debug("using seeded cache data in %s" % self.seeddir) # there was no indication on kernel cmdline or data # in the seeddir suggesting this handler should be used. @@ -80,14 +81,14 @@ class DataSourceNoCloud(DataSource.DataSource): seedfound=proto break if not seedfound: - self.log.debug("seed from %s not supported by %s" % + log.debug("seed from %s not supported by %s" % (seedfrom, self.__class__)) return False # this could throw errors, but the user told us to do it # so if errors are raised, let them raise (md_seed,ud) = util.read_seeded(seedfrom) - self.log.debug("using seeded cache data from %s" % seedfrom) + log.debug("using seeded cache data from %s" % seedfrom) # values in the command line override those from the seed md = util.mergedict(md,md_seed) -- cgit v1.2.3