Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
slapos
Commits
b6ba7fd2
Commit
b6ba7fd2
authored
Mar 29, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: check config modification more often
parent
255f61e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
16 deletions
+28
-16
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+1
-1
stack/monitor/scripts/monitor-document.py
stack/monitor/scripts/monitor-document.py
+27
-15
No files found.
stack/monitor/buildout.cfg
View file @
b6ba7fd2
...
...
@@ -154,7 +154,7 @@ md5sum = cc65aebd4c35b3172a7ca83abde761bc
[monitor-document-edit]
<= monitor-template-script
filename = monitor-document.py
md5sum =
79c53518e53ae8c8487b09bb49bc7b8
0
md5sum =
f3e557e5d81291a22d6d2837a9e37bd
0
[make-rss-script]
...
...
stack/monitor/scripts/monitor-document.py
View file @
b6ba7fd2
...
...
@@ -7,6 +7,7 @@ import json
import
argparse
import
subprocess
from
datetime
import
datetime
import
time
def
parseArguments
():
...
...
@@ -144,21 +145,32 @@ if __name__ == "__main__":
parser
=
parseArguments
()
parameter_tmp_file
=
os
.
path
.
join
(
parser
.
config_folder
,
'config.tmp.json'
)
config_file
=
os
.
path
.
join
(
parser
.
config_folder
,
'config.json'
)
result_dict
=
applyEditChage
(
parser
)
if
result_dict
!=
{}:
status
=
True
for
key
in
result_dict
:
if
not
result_dict
[
key
]:
status
=
False
if
status
and
os
.
path
.
exists
(
parameter_tmp_file
):
try
:
os
.
unlink
(
config_file
)
except
OSError
,
e
:
print
"ERROR cannot remove file: %s"
%
parameter_tmp_file
else
:
os
.
rename
(
parameter_tmp_file
,
config_file
)
# Run 4 times with sleep
run_counter
=
1
max_runn
=
4
sleep_time
=
15
while
True
:
result_dict
=
applyEditChage
(
parser
)
if
result_dict
!=
{}:
status
=
True
for
key
in
result_dict
:
if
not
result_dict
[
key
]:
status
=
False
if
status
and
os
.
path
.
exists
(
parameter_tmp_file
):
try
:
os
.
unlink
(
config_file
)
except
OSError
,
e
:
print
"ERROR cannot remove file: %s"
%
parameter_tmp_file
else
:
os
.
rename
(
parameter_tmp_file
,
config_file
)
if
run_counter
==
max_runn
:
break
else
:
run_counter
+=
1
time
.
sleep
(
sleep_time
)
...
...
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