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
Kazuhiko Shiozaki
slapos.toolbox
Commits
5ecc34b2
Commit
5ecc34b2
authored
Nov 27, 2012
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bubble up errors from subprocesses
parent
d4c77c66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
slapos/pubsub/notifier.py
slapos/pubsub/notifier.py
+15
-8
No files found.
slapos/pubsub/notifier.py
View file @
5ecc34b2
...
...
@@ -40,11 +40,14 @@ def main():
command
.
stdin
.
flush
()
command
.
stdin
.
close
()
if
command
.
wait
()
!=
0
:
command_failed
=
(
command
.
wait
()
!=
0
)
command_stderr
=
command
.
stderr
.
read
()
if
command_failed
:
content
=
(
"<p>Failed with returncode <em>%d</em>.</p>"
"<p>Standard error output is :</p><pre>%s</pre>"
)
%
(
command
.
poll
(),
command
.
stderr
.
read
()
.
replace
(
'&'
,
'&'
)
\
command
_stderr
.
replace
(
'&'
,
'&'
)
\
.
replace
(
'<'
,
'<'
)
\
.
replace
(
'>'
,
'>'
),
)
...
...
@@ -60,10 +63,14 @@ def main():
'slapos:%s'
%
uuid
.
uuid4
(),
])
if
command_failed
:
sys
.
stderr
.
write
(
'%s
\
n
'
%
command_stderr
)
sys
.
exit
(
1
)
feed
=
urllib2
.
urlopen
(
args
.
feed_url
[
0
])
body
=
feed
.
read
()
failed
=
False
some_notification_
failed
=
False
for
notif_url
in
args
.
notification_url
:
notification_url
=
urlparse
.
urlparse
(
notif_url
)
notification_port
=
notification_url
.
port
...
...
@@ -79,9 +86,9 @@ def main():
if
not
(
200
<=
response
.
status
<
300
):
sys
.
stderr
.
write
(
"The remote server at %s didn't send a successful reponse.
\
n
"
%
notif_url
)
sys
.
stderr
.
write
(
"Its response was %r
\
n
"
%
response
.
reason
)
failed
=
True
some_notification_
failed
=
True
if
failed
:
if
some_notification_
failed
:
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
...
...
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