mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
back-port #42612 to 2017.7
This commit is contained in:
parent
01e6e7e02c
commit
d73c4b55b7
@ -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
|
||||
@ -262,7 +268,7 @@ def module_install(name):
|
||||
name
|
||||
Path to file with module to install
|
||||
|
||||
.. versionadded:: develop
|
||||
.. versionadded:: 2016.11.6
|
||||
'''
|
||||
ret = {'name': name,
|
||||
'result': True,
|
||||
@ -283,7 +289,7 @@ def module_remove(name):
|
||||
name
|
||||
The name of the module to remove
|
||||
|
||||
.. versionadded:: develop
|
||||
.. versionadded:: 2016.11.6
|
||||
'''
|
||||
ret = {'name': name,
|
||||
'result': True,
|
||||
|
@ -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…
Reference in New Issue
Block a user