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

wip

parent 6eb84817
......@@ -39,7 +39,7 @@ import socket
import subprocess
import sys
from six.moves import socketserver
import six
import io
import threading
# Copied from erp5.util:erp5/util/testnode/ProcessManager.py
......@@ -149,7 +149,7 @@ class EqueueServer(socketserver.ThreadingUnixStreamServer):
# Handle request
self.logger.debug("Connection with file descriptor %d", request.fileno())
request.settimeout(self.options.timeout)
request_string = six.StringIO()
request_string = io.StringIO()
segment = None
try:
while segment != '':
......
......@@ -154,7 +154,7 @@ def generateMonitoringData(config, public_folder, private_folder, public_url,
)
except ValueError as e:
# 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
with open(promises_status_file, "w") as f:
......
......@@ -148,7 +148,7 @@ class Monitoring(object):
)
if config_list[0] == 'htpasswd':
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
parameter['description']['user'] = config_list[3]
parameter['description']['htpasswd'] = config_list[4]
......@@ -319,7 +319,7 @@ class Monitoring(object):
if os.path.exists(file):
os.unlink(file)
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
promise_list = os.listdir(self.legacy_promise_folder)
......@@ -338,7 +338,7 @@ class Monitoring(object):
try:
os.unlink(status_path)
except OSError as e:
print("Error: Failed to delete %s" % status_path, str(e))
print("Error: Failed to delete %s" % status_path, e)
else:
promise_list.pop(position)
......
......@@ -44,7 +44,7 @@ class MonitorConfigWrite(object):
wf.write(content.strip())
return True
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
def _htpasswdWrite(self, htpasswd_bin, parameter_dict, value):
......@@ -79,7 +79,7 @@ class MonitorConfigWrite(object):
# Skip if cors file is not empty
return True
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:
with open(self.monitor_https_cors, 'r') as cors_template:
template = jinja2.Template(cors_template.read())
......@@ -87,7 +87,7 @@ class MonitorConfigWrite(object):
with open(httpd_cors_file, 'w') as file:
file.write(rendered_string)
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
# Save current cors domain list
......@@ -95,14 +95,14 @@ class MonitorConfigWrite(object):
with open(old_httpd_cors_file, 'w') as cors_file:
cors_file.write(cors_domain)
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
# Restart httpd process
try:
subprocess.call(httpd_gracefull_bin)
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 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