mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
checking for apache2 installation
- checking whether apache2 is configured or not before checking whether it is enabled - changed python2 syntax to python3 - returning False
This commit is contained in:
parent
a7b2914990
commit
eca8b8d42e
@ -20,6 +20,7 @@ Python action utility functions.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
from distutils import spawn
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import psutil
|
import psutil
|
||||||
@ -121,12 +122,15 @@ def service_reload(service_name):
|
|||||||
def webserver_is_enabled(name, kind='config'):
|
def webserver_is_enabled(name, kind='config'):
|
||||||
"""Return whether a config/module/site is enabled in Apache."""
|
"""Return whether a config/module/site is enabled in Apache."""
|
||||||
option_map = {'config': '-c', 'site': '-s', 'module': '-m'}
|
option_map = {'config': '-c', 'site': '-s', 'module': '-m'}
|
||||||
try:
|
if spawn.find_executable('a2query'):
|
||||||
# Don't print anything on the terminal
|
try:
|
||||||
subprocess.check_output(['a2query', option_map[kind], name],
|
# Don't print anything on the terminal
|
||||||
stderr=subprocess.STDOUT)
|
subprocess.check_output(['a2query', option_map[kind], name],
|
||||||
return True
|
stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError:
|
return True
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user