summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
authorJuerg Haefliger <juergh@gmail.com>2013-06-19 08:44:00 +0200
committerJuerg Haefliger <juergh@gmail.com>2013-06-19 08:44:00 +0200
commit944623f4ad3e4c7319758c64053d06a3b05555a2 (patch)
treec8766adf057692157a0c454ac24a02a9fc5022f1 /cloudinit/config
parent812f82e7b3bad3f8127face552c76ef974b54661 (diff)
downloadvyos-cloud-init-944623f4ad3e4c7319758c64053d06a3b05555a2.tar.gz
vyos-cloud-init-944623f4ad3e4c7319758c64053d06a3b05555a2.zip
fix and cleanup usage of util.logexc
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_bootcmd.py5
-rw-r--r--cloudinit/config/cc_growpart.py8
-rw-r--r--cloudinit/config/cc_phone_home.py14
-rw-r--r--cloudinit/config/cc_rightscale_userdata.py10
-rw-r--r--cloudinit/config/cc_set_hostname.py6
-rw-r--r--cloudinit/config/cc_set_passwords.py6
-rw-r--r--cloudinit/config/cc_ssh.py10
-rw-r--r--cloudinit/config/cc_ssh_import_id.py6
-rw-r--r--cloudinit/config/cc_update_hostname.py6
9 files changed, 36 insertions, 35 deletions
diff --git a/cloudinit/config/cc_bootcmd.py b/cloudinit/config/cc_bootcmd.py
index 896cb4d0..3ac22967 100644
--- a/cloudinit/config/cc_bootcmd.py
+++ b/cloudinit/config/cc_bootcmd.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2011 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -50,6 +50,5 @@ def handle(name, cfg, cloud, log, _args):
cmd = ['/bin/sh', tmpf.name]
util.subp(cmd, env=env, capture=False)
except:
- util.logexc(log,
- ("Failed to run bootcmd module %s"), name)
+ util.logexc(log, "Failed to run bootcmd module %s", name)
raise
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index b6e1fd37..4f8c8f80 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -1,8 +1,10 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2011 Canonical Ltd.
+# Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
+# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
@@ -121,15 +123,15 @@ class ResizeGrowPart(object):
util.subp(["growpart", '--dry-run', diskdev, partnum])
except util.ProcessExecutionError as e:
if e.exit_code != 1:
- util.logexc(LOG, ("Failed growpart --dry-run for (%s, %s)" %
- (diskdev, partnum)))
+ util.logexc(LOG, "Failed growpart --dry-run for (%s, %s)",
+ diskdev, partnum)
raise ResizeFailedException(e)
return (before, before)
try:
util.subp(["growpart", diskdev, partnum])
except util.ProcessExecutionError as e:
- util.logexc(LOG, "Failed: growpart %s %s" % (diskdev, partnum))
+ util.logexc(LOG, "Failed: growpart %s %s", diskdev, partnum)
raise ResizeFailedException(e)
return (before, get_size(partdev))
diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py
index c873c8a8..2e058ccd 100644
--- a/cloudinit/config/cc_phone_home.py
+++ b/cloudinit/config/cc_phone_home.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2011 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -65,8 +65,8 @@ def handle(name, cfg, cloud, log, args):
tries = int(tries)
except:
tries = 10
- util.logexc(log, ("Configuration entry 'tries'"
- " is not an integer, using %s instead"), tries)
+ util.logexc(log, "Configuration entry 'tries' is not an integer, "
+ "using %s instead", tries)
if post_list == "all":
post_list = POST_LIST_ALL
@@ -85,8 +85,8 @@ def handle(name, cfg, cloud, log, args):
try:
all_keys[n] = util.load_file(path)
except:
- util.logexc(log, ("%s: failed to open, can not"
- " phone home that data!"), path)
+ util.logexc(log, "%s: failed to open, can not phone home that "
+ "data!", path)
submit_keys = {}
for k in post_list:
@@ -115,5 +115,5 @@ def handle(name, cfg, cloud, log, args):
retries=tries, sec_between=3,
ssl_details=util.fetch_ssl_details(cloud.paths))
except:
- util.logexc(log, ("Failed to post phone home data to"
- " %s in %s tries"), url, tries)
+ util.logexc(log, "Failed to post phone home data to %s in %s tries",
+ url, tries)
diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
index 4bf18516..c771728d 100644
--- a/cloudinit/config/cc_rightscale_userdata.py
+++ b/cloudinit/config/cc_rightscale_userdata.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2011 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -64,8 +64,8 @@ def handle(name, _cfg, cloud, log, _args):
" raw userdata"), name, MY_HOOKNAME)
return
except:
- util.logexc(log, ("Failed to parse query string %s"
- " into a dictionary"), ud)
+ util.logexc(log, "Failed to parse query string %s into a dictionary",
+ ud)
raise
wrote_fns = []
@@ -86,8 +86,8 @@ def handle(name, _cfg, cloud, log, _args):
wrote_fns.append(fname)
except Exception as e:
captured_excps.append(e)
- util.logexc(log, "%s failed to read %s and write %s",
- MY_NAME, url, fname)
+ util.logexc(log, "%s failed to read %s and write %s", MY_NAME, url,
+ fname)
if wrote_fns:
log.debug("Wrote out rightscale userdata to %s files", len(wrote_fns))
diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py
index 2b32fc94..5d7f4331 100644
--- a/cloudinit/config/cc_set_hostname.py
+++ b/cloudinit/config/cc_set_hostname.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2011 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -32,6 +32,6 @@ def handle(name, cfg, cloud, log, _args):
log.debug("Setting the hostname to %s (%s)", fqdn, hostname)
cloud.distro.set_hostname(hostname, fqdn)
except Exception:
- util.logexc(log, "Failed to set the hostname to %s (%s)",
- fqdn, hostname)
+ util.logexc(log, "Failed to set the hostname to %s (%s)", fqdn,
+ hostname)
raise
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index c6bf62fd..e93c8c6f 100644
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -81,8 +81,8 @@ def handle(_name, cfg, cloud, log, args):
util.subp(['chpasswd'], ch_in)
except Exception as e:
errors.append(e)
- util.logexc(log,
- "Failed to set passwords with chpasswd for %s", users)
+ util.logexc(log, "Failed to set passwords with chpasswd for %s",
+ users)
if len(randlist):
blurb = ("Set the following 'random' passwords\n",
diff --git a/cloudinit/config/cc_ssh.py b/cloudinit/config/cc_ssh.py
index 7ef20d9f..64a5e3cb 100644
--- a/cloudinit/config/cc_ssh.py
+++ b/cloudinit/config/cc_ssh.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -85,8 +85,8 @@ def handle(_name, cfg, cloud, log, _args):
util.subp(cmd, capture=False)
log.debug("Generated a key for %s from %s", pair[0], pair[1])
except:
- util.logexc(log, ("Failed generated a key"
- " for %s from %s"), pair[0], pair[1])
+ util.logexc(log, "Failed generated a key for %s from %s",
+ pair[0], pair[1])
else:
# if not, generate them
genkeys = util.get_cfg_option_list(cfg,
@@ -102,8 +102,8 @@ def handle(_name, cfg, cloud, log, _args):
with util.SeLinuxGuard("/etc/ssh", recursive=True):
util.subp(cmd, capture=False)
except:
- util.logexc(log, ("Failed generating key type"
- " %s to file %s"), keytype, keyfile)
+ util.logexc(log, "Failed generating key type %s to "
+ "file %s", keytype, keyfile)
try:
(users, _groups) = ds.normalize_users_groups(cfg, cloud.distro)
diff --git a/cloudinit/config/cc_ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py
index 83af36e9..50d96e15 100644
--- a/cloudinit/config/cc_ssh_import_id.py
+++ b/cloudinit/config/cc_ssh_import_id.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -71,8 +71,8 @@ def handle(_name, cfg, cloud, log, args):
try:
import_ssh_ids(import_ids, user, log)
except Exception as exc:
- util.logexc(log, "ssh-import-id failed for: %s %s" %
- (user, import_ids), exc)
+ util.logexc(log, "ssh-import-id failed for: %s %s", user,
+ import_ids)
elist.append(exc)
if len(elist):
diff --git a/cloudinit/config/cc_update_hostname.py b/cloudinit/config/cc_update_hostname.py
index 52225cd8..e396ba13 100644
--- a/cloudinit/config/cc_update_hostname.py
+++ b/cloudinit/config/cc_update_hostname.py
@@ -1,7 +1,7 @@
# vi: ts=4 expandtab
#
# Copyright (C) 2011 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
@@ -38,6 +38,6 @@ def handle(name, cfg, cloud, log, _args):
log.debug("Updating hostname to %s (%s)", fqdn, hostname)
cloud.distro.update_hostname(hostname, fqdn, prev_fn)
except Exception:
- util.logexc(log, "Failed to update the hostname to %s (%s)",
- fqdn, hostname)
+ util.logexc(log, "Failed to update the hostname to %s (%s)", fqdn,
+ hostname)
raise