diff --git a/salt/modules/solaris_shadow.py b/salt/modules/solaris_shadow.py index d96e54a1a3..51522dbf64 100644 --- a/salt/modules/solaris_shadow.py +++ b/salt/modules/solaris_shadow.py @@ -1,5 +1,5 @@ ''' -Manage the shadow file +Manage the password database on Solaris systems ''' # Import python libs @@ -20,7 +20,7 @@ def __virtual__(): ''' Only work on POSIX-like systems ''' - return 'shadow' if __grains__['kernel'] == 'SunOS' else False + return 'shadow' if __grains__.get('kernel', '') == 'SunOS' else False def info(name): @@ -36,7 +36,7 @@ def info(name): data = spwd.getspnam(name) ret = { 'name': data.sp_nam, - 'pwd': data.sp_pwd, + 'passwd': data.sp_pwd if data.sp_pwd != '!' else '', 'lstchg': data.sp_lstchg, 'min': data.sp_min, 'max': data.sp_max, @@ -46,7 +46,7 @@ def info(name): except KeyError: ret = { 'name': '', - 'pwd': '', + 'passwd': '', 'lstchg': '', 'min': '', 'max': '', @@ -59,7 +59,7 @@ def info(name): # Return what we can know ret = { 'name': '', - 'pwd': '', + 'passwd': '', 'lstchg': '', 'min': '', 'max': '', @@ -71,7 +71,7 @@ def info(name): data = pwd.getpwnam(name) ret.update({ 'name': name, - 'pwd': data.pw_dir + 'passwd': data.pw_dir }) except KeyError: return ret @@ -104,7 +104,7 @@ def info(name): # buildbot L 05/09/2013 0 99999 7 ret.update({ 'name': data.pw_name, - 'pwd': data.pw_dir, + 'passwd': data.pw_dir, 'lstchg': fields[2], 'min': int(fields[3]), 'max': int(fields[4]), @@ -180,7 +180,7 @@ def set_password(name, password): with salt.utils.fopen(s_file, 'w+') as ofile: ofile.writelines(lines) uinfo = info(name) - return uinfo['pwd'] == password + return uinfo['passwd'] == password def set_warndays(name, warndays):