Fix a bug in get_passworded_users
authorNikos Skalkotos <skalkoto@grnet.gr>
Mon, 5 Mar 2012 14:13:05 +0000 (16:13 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Mon, 5 Mar 2012 14:13:05 +0000 (16:13 +0200)
image_creator/os_type/unix.py

index 2aacd8a..e5e5a87 100644 (file)
@@ -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)