summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-06-21 08:38:12 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-06-21 08:38:12 -0700
commitf1cab0d88cbcfa7eaa698db7dcc252bb6543d6c0 (patch)
tree48ecd1dc9aacdd353d2d40e8617e40b87dd47288 /cloudinit
parentf7e638f6f58188cd4be1921cb045608f3c00d9c4 (diff)
downloadvyos-cloud-init-f1cab0d88cbcfa7eaa698db7dcc252bb6543d6c0.tar.gz
vyos-cloud-init-f1cab0d88cbcfa7eaa698db7dcc252bb6543d6c0.zip
1. Move all info() logging methods to debug()
2. Adjust comment on sources list from depends 3. For the /etc/timezone 'writing', add a header that says created by cloud-init
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/__init__.py6
-rw-r--r--cloudinit/distros/ubuntu.py6
-rw-r--r--cloudinit/helpers.py2
-rw-r--r--cloudinit/sources/DataSourceCloudStack.py2
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py6
-rw-r--r--cloudinit/sources/DataSourceEc2.py2
-rw-r--r--cloudinit/sources/DataSourceMAAS.py2
-rw-r--r--cloudinit/sources/DataSourceNoCloud.py2
-rw-r--r--cloudinit/sources/__init__.py22
-rw-r--r--cloudinit/url_helper.py14
10 files changed, 33 insertions, 31 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index e0ef6ee0..6325257c 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -133,14 +133,14 @@ class Distro(object):
raise NotImplementedError("Unknown interface action %s" % (action))
cmd = IFACE_ACTIONS[action]
try:
- LOG.info("Attempting to run %s interface action using command %s",
- action, cmd)
+ LOG.debug("Attempting to run %s interface action using command %s",
+ action, cmd)
(_out, err) = util.subp(cmd)
if len(err):
LOG.warn("Running %s resulted in stderr output: %s", cmd, err)
return True
except util.ProcessExecutionError:
- util.logexc(LOG, "Running %s failed", cmd)
+ util.logexc(LOG, "Running interface command %s failed", cmd)
return False
diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py
index fd7b7b8d..15af2e7f 100644
--- a/cloudinit/distros/ubuntu.py
+++ b/cloudinit/distros/ubuntu.py
@@ -112,7 +112,11 @@ class Distro(distros.Distro):
if not os.path.isfile(tz_file):
raise Exception(("Invalid timezone %s,"
" no file found at %s") % (tz, tz_file))
- tz_contents = "%s\n" % tz
+ tz_lines = [
+ "# Created by cloud-init",
+ str(tz),
+ ]
+ tz_contents = "\n".join(tz_lines)
tz_fn = self._paths.join(False, "/etc/timezone")
util.write_file(tz_fn, tz_contents)
util.copy(tz_file, self._paths.join(False, "/etc/localtime"))
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py
index b6974f3c..6751f4a5 100644
--- a/cloudinit/helpers.py
+++ b/cloudinit/helpers.py
@@ -161,7 +161,7 @@ class Runners(object):
if not args:
args = []
if sem.has_run(name, freq):
- LOG.info("%s already ran (freq=%s)", name, freq)
+ LOG.debug("%s already ran (freq=%s)", name, freq)
return (False, None)
with sem.lock(name, freq, clear_on_fail) as lk:
if not lk:
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index 83c577e6..751bef4f 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -98,7 +98,7 @@ class DataSourceCloudStack(sources.DataSource):
timeout=timeout, status_cb=LOG.warn)
if url:
- LOG.info("Using metadata source: '%s'", url)
+ LOG.debug("Using metadata source: '%s'", url)
else:
LOG.critical(("Giving up on waiting for the metadata from %s"
" after %s seconds"),
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 9905dad4..320dd1d1 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -87,10 +87,8 @@ class DataSourceConfigDrive(sources.DataSource):
# Update interfaces and ifup only on the local datasource
# this way the DataSourceConfigDriveNet doesn't do it also.
if 'network-interfaces' in md and self.dsmode == "local":
- if md['dsmode'] == "pass":
- LOG.info("Updating network interfaces from configdrive")
- else:
- LOG.debug("Updating network interfaces from configdrive")
+ LOG.debug("Updating network interfaces from config drive (%s)",
+ md['dsmode'])
self.distro.apply_network(md['network-interfaces'])
self.seed = found
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 0598dfa2..cb460de1 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -169,7 +169,7 @@ class DataSourceEc2(sources.DataSource):
timeout=timeout, status_cb=LOG.warn)
if url:
- LOG.info("Using metadata source: '%s'", url2base[url])
+ LOG.debug("Using metadata source: '%s'", url2base[url])
else:
LOG.critical("Giving up on md from %s after %s seconds",
urls, int(time.time() - start_time))
diff --git a/cloudinit/sources/DataSourceMAAS.py b/cloudinit/sources/DataSourceMAAS.py
index 104e7a54..22c90b7c 100644
--- a/cloudinit/sources/DataSourceMAAS.py
+++ b/cloudinit/sources/DataSourceMAAS.py
@@ -128,7 +128,7 @@ class DataSourceMAAS(sources.DataSource):
headers_cb=self.md_headers)
if url:
- LOG.info("Using metadata source: '%s'", url)
+ LOG.debug("Using metadata source: '%s'", url)
else:
LOG.critical("Giving up on md from %s after %i seconds",
urls, int(time.time() - starttime))
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
index 8499a97c..bed500a2 100644
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
@@ -152,7 +152,7 @@ class DataSourceNoCloud(sources.DataSource):
# ('local' for NoCloud, 'net' for NoCloudNet')
if ('network-interfaces' in md and
(self.dsmode in ("local", seeded_interfaces))):
- LOG.info("Updating network interfaces from %s", self)
+ LOG.debug("Updating network interfaces from %s", self)
self.distro.apply_network(md['network-interfaces'])
if md['dsmode'] == self.dsmode:
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 42e924b0..b25724a5 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -166,7 +166,7 @@ class DataSource(object):
def find_source(sys_cfg, distro, paths, ds_deps, cfg_list, pkg_list):
ds_list = list_sources(cfg_list, ds_deps, pkg_list)
ds_names = [util.obj_name(f) for f in ds_list]
- LOG.info("Searching for data source in: %s", ds_names)
+ LOG.debug("Searching for data source in: %s", ds_names)
for cls in ds_list:
try:
@@ -188,9 +188,9 @@ def find_source(sys_cfg, distro, paths, ds_deps, cfg_list, pkg_list):
# Return an ordered list of classes that match (if any)
def list_sources(cfg_list, depends, pkg_list):
src_list = []
- LOG.info(("Looking for for data source in: %s,"
- " via packages %s that matches dependencies %s"),
- cfg_list, pkg_list, depends)
+ LOG.debug(("Looking for for data source in: %s,"
+ " via packages %s that matches dependencies %s"),
+ cfg_list, pkg_list, depends)
for ds_name in cfg_list:
if not ds_name.startswith(DS_PREFIX):
ds_name = '%s%s' % (DS_PREFIX, ds_name)
@@ -207,17 +207,17 @@ def list_sources(cfg_list, depends, pkg_list):
return src_list
-# depends is a list of dependencies (DEP_FILESYSTEM)
-# dslist is a list of 2 item lists
-# dslist = [
+# 'depends' is a list of dependencies (DEP_FILESYSTEM)
+# ds_list is a list of 2 item lists
+# ds_list = [
# ( class, ( depends-that-this-class-needs ) )
# }
-# it returns a list of 'class' that matched these deps exactly
-# it is a helper function for DataSourceCollections
-def list_from_depends(depends, dslist):
+# It returns a list of 'class' that matched these deps exactly
+# It mainly is a helper function for DataSourceCollections
+def list_from_depends(depends, ds_list):
ret_list = []
depset = set(depends)
- for (cls, deps) in dslist:
+ for (cls, deps) in ds_list:
if depset == set(deps):
ret_list.append(cls)
return ret_list
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
index 223278ce..dbf72392 100644
--- a/cloudinit/url_helper.py
+++ b/cloudinit/url_helper.py
@@ -88,8 +88,8 @@ def readurl(url, data=None, timeout=None,
attempts = retries + 1
excepts = []
- LOG.info(("Attempting to open '%s' with %s attempts"
- " (%s retries, timeout=%s) to be performed"),
+ LOG.debug(("Attempting to open '%s' with %s attempts"
+ " (%s retries, timeout=%s) to be performed"),
url, attempts, retries, timeout)
open_args = {}
if timeout is not None:
@@ -105,8 +105,8 @@ def readurl(url, data=None, timeout=None,
headers = {}
if rh.headers:
headers = dict(rh.headers)
- LOG.info("Read from %s (%s, %sb) after %s attempts",
- url, status, len(content), (i + 1))
+ LOG.debug("Read from %s (%s, %sb) after %s attempts",
+ url, status, len(content), (i + 1))
return UrlResponse(status, content, headers)
except urllib2.HTTPError as e:
excepts.append(e)
@@ -165,7 +165,7 @@ def wait_for_url(urls, max_wait=None, timeout=None,
start_time = time.time()
def log_status_cb(msg):
- LOG.info(msg)
+ LOG.debug(msg)
if status_cb is None:
status_cb = log_status_cb
@@ -219,8 +219,8 @@ def wait_for_url(urls, max_wait=None, timeout=None,
break
loop_n = loop_n + 1
- LOG.info("Please wait %s seconds while we wait to try again",
- sleep_time)
+ LOG.debug("Please wait %s seconds while we wait to try again",
+ sleep_time)
time.sleep(sleep_time)
return False