"""WordOps OpenLiteSpeed Manager""" import subprocess from wo.core.logging import Log def check_config(self): """Check OpenLiteSpeed configuration and return boolean""" Log.debug(self, "Testing OpenLiteSpeed configuration ") sub = subprocess.Popen('/usr/local/lsws/bin/openlitespeed -t', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) output, error_output = sub.communicate() if 'ERROR' in str(error_output) or sub.returncode != 0: Log.debug(self, "OpenLiteSpeed configuration check failed") return False else: Log.debug(self, "OpenLiteSpeed configuration check was successful") return True