summaryrefslogtreecommitdiff
path: root/cloudinit/DataSourceNoCloud.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-01-31 16:40:43 -0500
committerScott Moser <smoser@ubuntu.com>2011-01-31 16:40:43 -0500
commit85444c68c8728d4324b71218d15d4f04ecdb4fbd (patch)
tree4759569605606ca1776eb2688d3d58e28752fa66 /cloudinit/DataSourceNoCloud.py
parent9e520d45a60a91750f9ad77da0be7dc58e57f4d8 (diff)
downloadvyos-cloud-init-85444c68c8728d4324b71218d15d4f04ecdb4fbd.tar.gz
vyos-cloud-init-85444c68c8728d4324b71218d15d4f04ecdb4fbd.zip
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
Diffstat (limited to 'cloudinit/DataSourceNoCloud.py')
-rw-r--r--cloudinit/DataSourceNoCloud.py9
1 files changed, 5 insertions, 4 deletions
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 <http://www.gnu.org/licenses/>.
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)