mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #42657 from nhavens/2017.7
back-port #42612 to 2017.7
This commit is contained in:
commit
4fcdab3ae9
2 changed files with 10 additions and 2 deletions
|
@ -171,8 +171,14 @@ def boolean(name, value, persist=False):
|
|||
name, rvalue)
|
||||
return ret
|
||||
|
||||
if __salt__['selinux.setsebool'](name, rvalue, persist):
|
||||
ret['result'] = __salt__['selinux.setsebool'](name, rvalue, persist)
|
||||
if ret['result']:
|
||||
ret['comment'] = 'Boolean {0} has been set to {1}'.format(name, rvalue)
|
||||
ret['changes'].update({'State': {'old': bools[name]['State'],
|
||||
'new': rvalue}})
|
||||
if persist and not default:
|
||||
ret['changes'].update({'Default': {'old': bools[name]['Default'],
|
||||
'new': rvalue}})
|
||||
return ret
|
||||
ret['comment'] = 'Failed to set the boolean {0} to {1}'.format(name, rvalue)
|
||||
return ret
|
||||
|
|
|
@ -118,9 +118,11 @@ class SelinuxTestCase(TestCase, LoaderModuleMockMixin):
|
|||
with patch.dict(selinux.__opts__, {'test': False}):
|
||||
comt = ('Boolean samba_create_home_dirs has been set to on')
|
||||
ret.update({'comment': comt, 'result': True})
|
||||
ret.update({'changes': {'State': {'old': 'off', 'new': 'on'}}})
|
||||
self.assertDictEqual(selinux.boolean(name, value), ret)
|
||||
|
||||
comt = ('Failed to set the boolean '
|
||||
'samba_create_home_dirs to on')
|
||||
ret.update({'comment': comt, 'result': True})
|
||||
ret.update({'comment': comt, 'result': False})
|
||||
ret.update({'changes': {}})
|
||||
self.assertDictEqual(selinux.boolean(name, value), ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue