From: Nikos Skalkotos Date: Mon, 5 Mar 2012 14:13:05 +0000 (+0200) Subject: Fix a bug in get_passworded_users X-Git-Tag: v0.1~145 X-Git-Url: https://code.grnet.gr/git/snf-image-creator/commitdiff_plain/36e348b6f3ed6d83b9d1a0c18e7b7572beb3c907 Fix a bug in get_passworded_users --- diff --git a/image_creator/os_type/unix.py b/image_creator/os_type/unix.py index 2aacd8a..e5e5a87 100644 --- a/image_creator/os_type/unix.py +++ b/image_creator/os_type/unix.py @@ -19,14 +19,14 @@ class Unix(OSBase): users = [] regexp = re.compile('(\S+):((?:!\S+)|(?:[^!*]\S+)|):(?:\S*:){6}') - for line in open('/etc/shadow', 'r').readlines(): + for line in self.g.cat('/etc/shadow').splitlines(): match = regexp.match(line) if not match: continue user, passwd = match.groups() if len(passwd) > 0 and passwd[0] == '!': - print "Warning: %s is locked" % user + print "Warning: Ignoring locked %s account." % user else: users.append(user)