Skip to content
Snippets Groups Projects
Commit 36b06b5a authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add a metadata check in _remove_users_account

Check if USERS metadata exists in _remove_users_account before trying
to access it.
parent fd9ecc9e
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2015 GRNET S.A.
# Copyright (C) 2011-2016 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -79,7 +79,8 @@ class Linux(Unix):
# Remove users from /etc/passwd
if self.image.g.is_file('/etc/passwd'):
passwd = []
metadata_users = self.meta['USERS'].split()
metadata_users = self.meta['USERS'].split() \
if 'USERS' in self.meta else []
for line in self.image.g.cat('/etc/passwd').splitlines():
fields = line.split(':')
if int(fields[2]) > 1000:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment