mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Be more flexible when checking if Apache Debian-style mod is enabled
This commit is contained in:
parent
05a15bf564
commit
450c821432
@ -151,10 +151,15 @@ def check_mod_enabled(mod):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' apache.check_mod_enabled status.conf
|
||||
salt '*' apache.check_mod_enabled status
|
||||
salt '*' apache.check_mod_enabled status.load
|
||||
salt '*' apache.check_mod_enabled status.conf
|
||||
'''
|
||||
return os.path.islink('/etc/apache2/mods-enabled/{0}'.format(mod))
|
||||
if mod.endswith('.load') or mod.endswith('.conf'):
|
||||
mod_file = mod
|
||||
else:
|
||||
mod_file = '{0}.load'.format(mod)
|
||||
return os.path.islink('/etc/apache2/mods-enabled/{0}'.format(mod_file))
|
||||
|
||||
|
||||
def a2enmod(mod):
|
||||
|
@ -36,7 +36,7 @@ def enable(name):
|
||||
'''
|
||||
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
|
||||
|
||||
is_enabled = __salt__['apache.check_mod_enabled']('{0}.load'.format(name))
|
||||
is_enabled = __salt__['apache.check_mod_enabled'](name)
|
||||
if not is_enabled:
|
||||
if __opts__['test']:
|
||||
msg = 'Apache module {0} is set to be enabled.'.format(name)
|
||||
@ -70,7 +70,7 @@ def disable(name):
|
||||
'''
|
||||
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
|
||||
|
||||
is_enabled = __salt__['apache.check_mod_enabled']('{0}.load'.format(name))
|
||||
is_enabled = __salt__['apache.check_mod_enabled'](name)
|
||||
if is_enabled:
|
||||
if __opts__['test']:
|
||||
msg = 'Apache module {0} is set to be disabled.'.format(name)
|
||||
|
Loading…
Reference in New Issue
Block a user