diff options
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/distros/netbsd.py | 10 | ||||
-rw-r--r-- | cloudinit/distros/openbsd.py | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/cloudinit/distros/netbsd.py b/cloudinit/distros/netbsd.py index 69d07846..6ae60943 100644 --- a/cloudinit/distros/netbsd.py +++ b/cloudinit/distros/netbsd.py @@ -95,10 +95,11 @@ class NetBSD(cloudinit.distros.bsd.BSD): crypt.mksalt(method)) try: - util.subp(['usermod', '-C', 'no', '-p', hashed_pw, user]) + util.subp(['usermod', '-p', hashed_pw, user]) except Exception: util.logexc(LOG, "Failed to set password for %s", user) raise + self.unlock_passwd(user) def force_passwd_change(self, user): try: @@ -114,6 +115,13 @@ class NetBSD(cloudinit.distros.bsd.BSD): util.logexc(LOG, "Failed to lock user %s", name) raise + def unlock_passwd(self, name): + try: + util.subp(['usermod', '-C', 'no', name]) + except Exception: + util.logexc(LOG, "Failed to unlock user %s", name) + raise + def apply_locale(self, locale, out_fn=None): LOG.debug('Cannot set the locale.') diff --git a/cloudinit/distros/openbsd.py b/cloudinit/distros/openbsd.py index dbe1f069..ca094156 100644 --- a/cloudinit/distros/openbsd.py +++ b/cloudinit/distros/openbsd.py @@ -32,6 +32,9 @@ class Distro(cloudinit.distros.netbsd.NetBSD): util.logexc(LOG, "Failed to lock user %s", name) raise + def unlock_passwd(self, name): + pass + def _get_pkg_cmd_environ(self): """Return env vars used in OpenBSD package_command operations""" os_release = platform.release() |