mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +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 distutils import spawn
|
||||
import os
|
||||
import logging
|
||||
import psutil
|
||||
@ -121,12 +122,15 @@ def service_reload(service_name):
|
||||
def webserver_is_enabled(name, kind='config'):
|
||||
"""Return whether a config/module/site is enabled in Apache."""
|
||||
option_map = {'config': '-c', 'site': '-s', 'module': '-m'}
|
||||
try:
|
||||
# Don't print anything on the terminal
|
||||
subprocess.check_output(['a2query', option_map[kind], name],
|
||||
stderr=subprocess.STDOUT)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
if spawn.find_executable('a2query'):
|
||||
try:
|
||||
# Don't print anything on the terminal
|
||||
subprocess.check_output(['a2query', option_map[kind], name],
|
||||
stderr=subprocess.STDOUT)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user