Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos.toolbox
Commits
8835dda1
Commit
8835dda1
authored
Oct 26, 2018
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
6eb84817
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
slapos/equeue/__init__.py
slapos/equeue/__init__.py
+2
-2
slapos/monitor/globalstate.py
slapos/monitor/globalstate.py
+1
-1
slapos/monitor/monitor.py
slapos/monitor/monitor.py
+3
-3
slapos/monitor/monitor_config_write.py
slapos/monitor/monitor_config_write.py
+5
-5
No files found.
slapos/equeue/__init__.py
View file @
8835dda1
...
...
@@ -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
!=
''
:
...
...
slapos/monitor/globalstate.py
View file @
8835dda1
...
...
@@ -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
:
...
...
slapos/monitor/monitor.py
View file @
8835dda1
...
...
@@ -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
)
...
...
slapos/monitor/monitor_config_write.py
View file @
8835dda1
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment