mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Fix system.set_computer_desc
This would always return that the description had been changed, resulting in the corresponding state always thinking the change had been successful. This commit fixes that behavior.
This commit is contained in:
parent
46520512a6
commit
fc9afc708a
@ -205,7 +205,7 @@ def set_computer_desc(desc):
|
||||
'''
|
||||
cmd = 'net config server /srvcomment:"{0}"'.format(desc)
|
||||
__salt__['cmd.run'](cmd)
|
||||
return {'Computer Description': str(desc)}
|
||||
return {'Computer Description': get_computer_desc()}
|
||||
|
||||
|
||||
def get_computer_desc():
|
||||
|
@ -64,15 +64,15 @@ def computer_desc(name):
|
||||
.format(name))
|
||||
return ret
|
||||
|
||||
if not __salt__['system.set_computer_desc'](name):
|
||||
ret['result'] = False
|
||||
ret['comment'] = ('Unable to set computer description to '
|
||||
'{0!r}'.format(name))
|
||||
else:
|
||||
result = __salt__['system.set_computer_desc'](name)
|
||||
if result['Computer Description'] == name:
|
||||
ret['comment'] = ('Computer description successfully changed to {0!r}'
|
||||
.format(name))
|
||||
ret['changes'] = {'old': before_desc, 'new': name}
|
||||
|
||||
else:
|
||||
ret['result'] = False
|
||||
ret['comment'] = ('Unable to set computer description to '
|
||||
'{0!r}'.format(name))
|
||||
return ret
|
||||
|
||||
computer_description = computer_desc
|
||||
|
Loading…
Reference in New Issue
Block a user