From 38b21ce3c0972d0659c4a4a9fb22640ff1d3f439 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 4 Feb 2011 16:56:17 -0500 Subject: fix logging in DataSource modules Previous logging was getting 'None' set in the DataSource collections. Thus, 'log.debug' would throw error. I think it is proper to pull in the base cloudinit's log. --- cloudinit/DataSource.py | 9 --------- cloudinit/DataSourceEc2.py | 3 +-- cloudinit/DataSourceNoCloud.py | 3 +-- cloudinit/DataSourceOVF.py | 2 +- cloudinit/__init__.py | 1 - 5 files changed, 3 insertions(+), 15 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py index 43f66eff..0bf17b45 100644 --- a/cloudinit/DataSource.py +++ b/cloudinit/DataSource.py @@ -22,15 +22,6 @@ DEP_NETWORK = "NETWORK" import UserDataHandler as ud -log = None -def setlog(log_in=None, name="DataSource"): - log = log_in - if log is None: - class NullHandler(logging.Handler): - def emit(self,record): pass - log = logging.getLogger(name) - log.addHandler(NullHandler()) - class DataSource: userdata = None metadata = None diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py index eb0036a5..9c385c6c 100644 --- a/cloudinit/DataSourceEc2.py +++ b/cloudinit/DataSourceEc2.py @@ -17,9 +17,8 @@ # along with this program. If not, see . import DataSource -log = DataSource.log -from cloudinit import seeddir +from cloudinit import seeddir, log import cloudinit.util as util import socket import urllib2 diff --git a/cloudinit/DataSourceNoCloud.py b/cloudinit/DataSourceNoCloud.py index 5aebb50f..3d429bc5 100644 --- a/cloudinit/DataSourceNoCloud.py +++ b/cloudinit/DataSourceNoCloud.py @@ -17,9 +17,8 @@ # along with this program. If not, see . import DataSource -log = DataSource.log -from cloudinit import seeddir +from cloudinit import seeddir, log import cloudinit.util as util import sys import os.path diff --git a/cloudinit/DataSourceOVF.py b/cloudinit/DataSourceOVF.py index a0c53c69..6f0bd523 100644 --- a/cloudinit/DataSourceOVF.py +++ b/cloudinit/DataSourceOVF.py @@ -18,7 +18,7 @@ import DataSource -from cloudinit import seeddir +from cloudinit import seeddir, log import cloudinit.util as util import sys import os.path diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index bb4c495c..99cc4d46 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -102,7 +102,6 @@ def logging_set_from_cfg(cfg): import DataSource -DataSource.setlog(log) import UserDataHandler class CloudInit: -- cgit v1.2.3