Revision 5f7e1e0c
b/image_creator/os_type/unix.py | ||
---|---|---|
51 | 51 |
super(Unix, self).__init__(rootdev, ghandler, output) |
52 | 52 |
|
53 | 53 |
self.meta["USERS"] = " ".join(self._get_passworded_users()) |
54 |
# Delete the USERS metadata if empty |
|
55 |
if not len(self.meta['USERS']): |
|
56 |
self.out.warn("No passworded users found!") |
|
57 |
del self.meta['USERS'] |
|
58 |
|
|
54 | 59 |
|
55 | 60 |
def _get_passworded_users(self): |
56 | 61 |
users = [] |
... | ... | |
77 | 82 |
self.out.output("Removing all user accounts with id greater than " |
78 | 83 |
"1000") |
79 | 84 |
|
85 |
if 'USERS' not in self.meta: |
|
86 |
return |
|
87 |
|
|
80 | 88 |
# Remove users from /etc/passwd |
81 | 89 |
passwd = [] |
82 | 90 |
removed_users = {} |
... | ... | |
92 | 100 |
passwd.append(':'.join(fields)) |
93 | 101 |
|
94 | 102 |
self.meta['USERS'] = " ".join(metadata_users) |
103 |
|
|
104 |
# Delete the USERS metadata if empty |
|
105 |
if not len(self.meta['USERS']): |
|
106 |
del self.meta['USERS'] |
|
107 |
|
|
95 | 108 |
self.g.write('/etc/passwd', '\n'.join(passwd) + '\n') |
96 | 109 |
|
97 | 110 |
# Remove the corresponding /etc/shadow entries |
Also available in: Unified diff