cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #00379
[Merge] lp:~harlowja/cloud-init/freebsd-cleaning-part-duo into lp:cloud-init
Joshua Harlow has proposed merging lp:~harlowja/cloud-init/freebsd-cleaning-part-duo into lp:cloud-init.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/freebsd-cleaning-part-duo/+merge/203196
Fix logexc usage in freebsd distro
- There appeared to be a few logexc calls
that did not pass the logger in, fix those
locations where this occured.
- When a group member adding fails, log the
error and try the next member instead of
failing adding any more members
--
https://code.launchpad.net/~harlowja/cloud-init/freebsd-cleaning-part-duo/+merge/203196
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/freebsd-cleaning-part-duo into lp:cloud-init.
=== modified file 'cloudinit/distros/freebsd.py'
--- cloudinit/distros/freebsd.py 2014-01-25 01:28:05 +0000
+++ cloudinit/distros/freebsd.py 2014-01-25 01:38:05 +0000
@@ -109,16 +109,20 @@
util.subp(group_add_cmd)
LOG.info("Created new group %s", name)
except Exception:
- util.logexc("Failed to create group %s", name)
+ util.logexc(LOG, "Failed to create group %s", name)
if len(members) > 0:
for member in members:
if not util.is_user(member):
LOG.warn("Unable to add group member '%s' to group '%s'"
- "; user does not exist.", member, name)
+ "; user does not exist.", member, name)
continue
- util.subp(['pw', 'usermod', '-n', name, '-G', member])
- LOG.info("Added user '%s' to group '%s'", member, name)
+ try:
+ util.subp(['pw', 'usermod', '-n', name, '-G', member])
+ LOG.info("Added user '%s' to group '%s'", member, name)
+ except Exception:
+ util.logexc(LOG, "Failed to add user '%s' to group '%s'",
+ member, name)
def add_user(self, name, **kwargs):
if util.is_user(name):
@@ -230,15 +234,16 @@
util.write_file(self.login_conf_fn, newconf.getvalue())
try:
- util.logexc("Running cap_mkdb for %s", locale)
+ LOG.debug("Running cap_mkdb for %s", locale)
util.subp(['cap_mkdb', self.login_conf_fn])
except util.ProcessExecutionError:
# cap_mkdb failed, so restore the backup.
- util.logexc("Failed to apply locale %s", locale)
+ util.logexc(LOG, "Failed to apply locale %s", locale)
try:
util.copy(self.login_conf_fn_bak, self.login_conf_fn)
except IOError:
- util.logexc("Failed to restore %s backup", self.login_conf_fn)
+ util.logexc(LOG, "Failed to restore %s backup",
+ self.login_conf_fn)
def install_packages(self, pkglist):
return
Follow ups