added change detection for block device tune, reformatting

This commit is contained in:
Robert Fach 2015-03-12 12:47:28 +00:00
parent 0bced7a2ca
commit 5c526b2670

View File

@ -76,15 +76,15 @@ def tuned(name, **kwargs):
changes = __salt__['blockdev.tune'](name, **kwargs)
changeset = {}
for key in changes:
if current[key] != changes[key]:
changeset[key] = 'Changed from {0} to {1}'.format(current[key], changes[key])
if current[key] != changes[key]:
changeset[key] = 'Changed from {0} to {1}'.format(current[key], changes[key])
if changes:
if changeset:
ret['comment'] = ('Block device {0} '
'successfully modified ').format(name)
ret['changes'] = changeset
else:
ret['comment'] = 'Block device {0} already in correct state'.format(name)
ret['comment'] = ('Block device {0} '
'successfully modified ').format(name)
ret['changes'] = changeset
else:
ret['comment'] = 'Block device {0} already in correct state'.format(name)
else:
ret['comment'] = 'Failed to modify block device {0}'.format(name)
ret['result'] = False