mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #42618 from rallytime/bp-41690
Back-port #41690 to 2017.7
This commit is contained in:
commit
d48749b476
@ -86,8 +86,11 @@ def options_present(name, sections=None, separator='=', strict=False):
|
||||
changes[section_name].update({key_to_remove: ''})
|
||||
changes[section_name].update({key_to_remove: {'before': orig_value,
|
||||
'after': None}})
|
||||
changes[section_name].update(
|
||||
__salt__['ini.set_option'](name, {section_name: section_body}, separator)[section_name])
|
||||
options_updated = __salt__['ini.set_option'](name, {section_name: section_body}, separator)
|
||||
if options_updated:
|
||||
changes[section_name].update(options_updated[section_name])
|
||||
if not changes[section_name]:
|
||||
del changes[section_name]
|
||||
else:
|
||||
changes = __salt__['ini.set_option'](name, sections, separator)
|
||||
except IOError as err:
|
||||
@ -99,8 +102,12 @@ def options_present(name, sections=None, separator='=', strict=False):
|
||||
ret['comment'] = 'Errors encountered. {0}'.format(changes['error'])
|
||||
ret['changes'] = {}
|
||||
else:
|
||||
ret['comment'] = 'Changes take effect'
|
||||
if changes:
|
||||
ret['changes'] = changes
|
||||
ret['comment'] = 'Changes take effect'
|
||||
else:
|
||||
ret['changes'] = {}
|
||||
ret['comment'] = 'No changes take effect'
|
||||
return ret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user