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
isaak yansane-sisk
slapos
Commits
775860e6
Commit
775860e6
authored
Jun 29, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: run promise script should not fail when json is bad
parent
c8aa019e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+1
-1
stack/monitor/scripts/run-promise.py
stack/monitor/scripts/run-promise.py
+13
-5
No files found.
stack/monitor/buildout.cfg
View file @
775860e6
...
@@ -137,7 +137,7 @@ md5sum = 280412f9024030c8cae343c2b07e5130
...
@@ -137,7 +137,7 @@ md5sum = 280412f9024030c8cae343c2b07e5130
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/scripts/run-promise.py
template = ${:_profile_base_location_}/scripts/run-promise.py
rendered = ${buildout:parts-directory}/monitor-scripts/run-promise.py
rendered = ${buildout:parts-directory}/monitor-scripts/run-promise.py
md5sum =
2570b11cd1f718f240a9c7a05ffa861d
md5sum =
641c6917bbd19a7abaebb120ccd4e713
mode = 0755
mode = 0755
context =
context =
raw python ${buildout:directory}/bin/${extra-eggs:interpreter}
raw python ${buildout:directory}/bin/${extra-eggs:interpreter}
...
...
stack/monitor/scripts/run-promise.py
View file @
775860e6
...
@@ -10,6 +10,7 @@ import time
...
@@ -10,6 +10,7 @@ import time
from
shutil
import
copyfile
from
shutil
import
copyfile
import
glob
import
glob
import
argparse
import
argparse
import
traceback
def
parseArguments
():
def
parseArguments
():
"""
"""
...
@@ -71,9 +72,12 @@ def main():
...
@@ -71,9 +72,12 @@ def main():
status_json
[
'change-time'
]
=
ps_process
.
create_time
()
status_json
[
'change-time'
]
=
ps_process
.
create_time
()
if
os
.
path
.
exists
(
parser
.
output
):
if
os
.
path
.
exists
(
parser
.
output
):
with
open
(
parser
.
output
)
as
f
:
with
open
(
parser
.
output
)
as
f
:
try
:
last_result
=
json
.
loads
(
f
.
read
())
last_result
=
json
.
loads
(
f
.
read
())
if
status_json
[
'status'
]
==
last_result
[
'status'
]
and
last_result
.
has_key
(
'change-time'
):
if
status_json
[
'status'
]
==
last_result
[
'status'
]
and
last_result
.
has_key
(
'change-time'
):
status_json
[
'change-time'
]
=
last_result
[
'change-time'
]
status_json
[
'change-time'
]
=
last_result
[
'change-time'
]
except
ValueError
:
pass
updateStatusHistoryFolder
(
updateStatusHistoryFolder
(
parser
.
promise_name
,
parser
.
promise_name
,
...
@@ -99,7 +103,11 @@ def updateStatusHistoryFolder(name, status_file, history_folder, promise_type):
...
@@ -99,7 +103,11 @@ def updateStatusHistoryFolder(name, status_file, history_folder, promise_type):
pass
pass
else
:
raise
else
:
raise
with
open
(
status_file
,
'r'
)
as
sf
:
with
open
(
status_file
,
'r'
)
as
sf
:
try
:
status_dict
=
json
.
loads
(
sf
.
read
())
status_dict
=
json
.
loads
(
sf
.
read
())
except
ValueError
:
traceback
.
print_exc
()
return
if
promise_type
==
'status'
:
if
promise_type
==
'status'
:
filename
=
'%s.history.json'
%
name
filename
=
'%s.history.json'
%
name
...
...
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