summaryrefslogtreecommitdiff
path: root/cloudinit/distros/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r--cloudinit/distros/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 6a684b89..be32757d 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -335,9 +335,10 @@ class Distro(object):
self.set_passwd(name, kwargs['plain_text_passwd'])
# Default locking down the account.
- if ('lock_passwd' not in kwargs and
- ('lock_passwd' in kwargs and kwargs['lock_passwd']) or
- 'system' not in kwargs):
+ #
+ # Which means if lock_passwd is False (on non-existent its true)
+ # then lock or if system is True (on non-existent its false) then lock.
+ if (kwargs.get('lock_passwd', True) or kwargs.get('system', False)):
try:
util.subp(['passwd', '--lock', name])
except Exception as e: