summaryrefslogtreecommitdiff
path: root/cloudinit/DataSourceEc2.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/DataSourceEc2.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/DataSourceEc2.py')
-rw-r--r--cloudinit/DataSourceEc2.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py
index 183c57b8..eb0036a5 100644
--- a/cloudinit/DataSourceEc2.py
+++ b/cloudinit/DataSourceEc2.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
@@ -40,7 +41,7 @@ class DataSourceEc2(DataSource.DataSource):
if util.read_optional_seed(seedret,base=self.seeddir+ "/"):
self.userdata_raw = seedret['user-data']
self.metadata = seedret['meta-data']
- self.log.debug("using seeded ec2 data in %s" % self.seeddir)
+ log.debug("using seeded ec2 data in %s" % self.seeddir)
return True
try:
@@ -102,13 +103,13 @@ class DataSourceEc2(DataSource.DataSource):
reason = "url error [%s]" % e.reason
if x == 0:
- self.log.warning("waiting for metadata service at %s\n" % url)
+ log.warning("waiting for metadata service at %s\n" % url)
- self.log.warning(" %s [%02s/%s]: %s\n" %
+ log.warning(" %s [%02s/%s]: %s\n" %
(time.strftime("%H:%M:%S",time.gmtime()), x+1, sleeps, reason))
time.sleep(sleeptime)
- self.log.critical("giving up on md after %i seconds\n" %
+ log.critical("giving up on md after %i seconds\n" %
int(time.time()-starttime))
return False
@@ -128,7 +129,7 @@ class DataSourceEc2(DataSource.DataSource):
if entname == "ephemeral" and name == "ephemeral0":
found = device
if found == None:
- self.log.warn("unable to convert %s to a device" % name)
+ log.warn("unable to convert %s to a device" % name)
return None
# LP: #611137
@@ -151,7 +152,7 @@ class DataSourceEc2(DataSource.DataSource):
for nto in tlist:
cand = "/dev/%s%s" % (nto, short[len(nfrom):])
if os.path.exists(cand):
- self.log.debug("remapped device name %s => %s" % (found,cand))
+ log.debug("remapped device name %s => %s" % (found,cand))
return(cand)
return ofound