Commit 8835dda1 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

wip

parent 6eb84817
...@@ -39,7 +39,7 @@ import socket ...@@ -39,7 +39,7 @@ import socket
import subprocess import subprocess
import sys import sys
from six.moves import socketserver from six.moves import socketserver
import six import io
import threading import threading
# Copied from erp5.util:erp5/util/testnode/ProcessManager.py # Copied from erp5.util:erp5/util/testnode/ProcessManager.py
...@@ -149,7 +149,7 @@ class EqueueServer(socketserver.ThreadingUnixStreamServer): ...@@ -149,7 +149,7 @@ class EqueueServer(socketserver.ThreadingUnixStreamServer):
# Handle request # Handle request
self.logger.debug("Connection with file descriptor %d", request.fileno()) self.logger.debug("Connection with file descriptor %d", request.fileno())
request.settimeout(self.options.timeout) request.settimeout(self.options.timeout)
request_string = six.StringIO() request_string = io.StringIO()
segment = None segment = None
try: try:
while segment != '': while segment != '':
......
...@@ -154,7 +154,7 @@ def generateMonitoringData(config, public_folder, private_folder, public_url, ...@@ -154,7 +154,7 @@ def generateMonitoringData(config, public_folder, private_folder, public_url,
) )
except ValueError as e: except ValueError as e:
# bad json file # bad json file
print("ERROR: Bad json file at: %s\n%s" % (file, str(e))) print("ERROR: Bad json file at: %s\n%s" % (file, e))
continue continue
with open(promises_status_file, "w") as f: with open(promises_status_file, "w") as f:
......
...@@ -148,7 +148,7 @@ class Monitoring(object): ...@@ -148,7 +148,7 @@ class Monitoring(object):
) )
if config_list[0] == 'htpasswd': if config_list[0] == 'htpasswd':
if len(config_list) != 5 or not os.path.exists(config_list[4]): if len(config_list) != 5 or not os.path.exists(config_list[4]):
print('htpasswd file is not specified: %s' % str(config_list)) print('htpasswd file is not specified: %s' % config_list)
continue continue
parameter['description']['user'] = config_list[3] parameter['description']['user'] = config_list[3]
parameter['description']['htpasswd'] = config_list[4] parameter['description']['htpasswd'] = config_list[4]
...@@ -319,7 +319,7 @@ class Monitoring(object): ...@@ -319,7 +319,7 @@ class Monitoring(object):
if os.path.exists(file): if os.path.exists(file):
os.unlink(file) os.unlink(file)
except OSError as e: except OSError as e:
print("failed to remove file %s." % file, str(e)) print("failed to remove file %s." % file, e)
# cleanup result of promises that was removed # cleanup result of promises that was removed
promise_list = os.listdir(self.legacy_promise_folder) promise_list = os.listdir(self.legacy_promise_folder)
...@@ -338,7 +338,7 @@ class Monitoring(object): ...@@ -338,7 +338,7 @@ class Monitoring(object):
try: try:
os.unlink(status_path) os.unlink(status_path)
except OSError as e: except OSError as e:
print("Error: Failed to delete %s" % status_path, str(e)) print("Error: Failed to delete %s" % status_path, e)
else: else:
promise_list.pop(position) promise_list.pop(position)
......
...@@ -44,7 +44,7 @@ class MonitorConfigWrite(object): ...@@ -44,7 +44,7 @@ class MonitorConfigWrite(object):
wf.write(content.strip()) wf.write(content.strip())
return True return True
except OSError as e: except OSError as e:
print("ERROR while writing changes to %s.\n %s" % (file_path, str(e))) print("ERROR while writing changes to %s.\n %s" % (file_path, e))
return False return False
def _htpasswdWrite(self, htpasswd_bin, parameter_dict, value): def _htpasswdWrite(self, htpasswd_bin, parameter_dict, value):
...@@ -79,7 +79,7 @@ class MonitorConfigWrite(object): ...@@ -79,7 +79,7 @@ class MonitorConfigWrite(object):
# Skip if cors file is not empty # Skip if cors file is not empty
return True return True
except OSError as e: except OSError as e:
print("Failed to open file at %s. \n%s" % (old_httpd_cors_file, str(e))) print("Failed to open file at %s. \n%s" % (old_httpd_cors_file, e))
try: try:
with open(self.monitor_https_cors, 'r') as cors_template: with open(self.monitor_https_cors, 'r') as cors_template:
template = jinja2.Template(cors_template.read()) template = jinja2.Template(cors_template.read())
...@@ -87,7 +87,7 @@ class MonitorConfigWrite(object): ...@@ -87,7 +87,7 @@ class MonitorConfigWrite(object):
with open(httpd_cors_file, 'w') as file: with open(httpd_cors_file, 'w') as file:
file.write(rendered_string) file.write(rendered_string)
except OSError as e: except OSError as e:
print("ERROR while writing CORS changes to %s.\n %s" % (httpd_cors_file, str(e))) print("ERROR while writing CORS changes to %s.\n %s" % (httpd_cors_file, e))
return False return False
# Save current cors domain list # Save current cors domain list
...@@ -95,14 +95,14 @@ class MonitorConfigWrite(object): ...@@ -95,14 +95,14 @@ class MonitorConfigWrite(object):
with open(old_httpd_cors_file, 'w') as cors_file: with open(old_httpd_cors_file, 'w') as cors_file:
cors_file.write(cors_domain) cors_file.write(cors_domain)
except OSError as e: except OSError as e:
print("Failed to open file at %s. \n%s" % (old_httpd_cors_file, str(e))) print("Failed to open file at %s. \n%s" % (old_httpd_cors_file, e))
return False return False
# Restart httpd process # Restart httpd process
try: try:
subprocess.call(httpd_gracefull_bin) subprocess.call(httpd_gracefull_bin)
except OSError as e: except OSError as e:
print("Failed to execute command %s.\n %s" % (httpd_gracefull_bin, str(e))) print("Failed to execute command %s.\n %s" % (httpd_gracefull_bin, e))
return False return False
return True return True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment