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
Iliya Manolov
slapos.toolbox
Commits
c5034849
Commit
c5034849
authored
Oct 10, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pubsub: don't swallow output of subprocess to allow debug.
Swallowing is bad. baaad.
parent
34df4cb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
26 deletions
+19
-26
slapos/pubsub/notifier.py
slapos/pubsub/notifier.py
+19
-26
No files found.
slapos/pubsub/notifier.py
View file @
c5034849
...
...
@@ -4,7 +4,6 @@
import
argparse
import
csv
import
httplib
import
os
import
socket
import
subprocess
import
sys
...
...
@@ -32,28 +31,23 @@ def main():
args
=
parser
.
parse_args
()
with
open
(
os
.
devnull
)
as
devnull
:
command
=
subprocess
.
Popen
(
args
.
executable
[
0
],
stdin
=
subprocess
.
PIPE
,
stdout
=
devnull
,
stderr
=
subprocess
.
PIPE
,
close_fds
=
True
)
command
.
stdin
.
flush
()
command
.
stdin
.
close
()
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
.
replace
(
'&'
,
'&'
)
\
.
replace
(
'<'
,
'<'
)
\
.
replace
(
'>'
,
'>'
),
)
else
:
content
=
"<p>Everything went well.</p>"
try
:
content
=
subprocess
.
check_output
(
args
.
executable
[
0
],
stderr
=
subprocess
.
STDOUT
)
exit_code
=
0
except
subprocess
.
CalledProcessError
as
e
:
content
=
e
.
output
exit_code
=
e
.
returncode
print
content
content
+=
(
"
\
n
<p>Failed with returncode <em>%d</em>.</p>"
"<p>Output is: </p><pre>%s</pre>"
%
(
exit_code
,
content
.
replace
(
'&'
,
'&'
).
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
)
))
with
open
(
args
.
logfile
[
0
],
'a'
)
as
file_
:
cvsfile
=
csv
.
writer
(
file_
)
...
...
@@ -64,9 +58,8 @@ def main():
'slapos:%s'
%
uuid
.
uuid4
(),
])
if
command_failed
:
sys
.
stderr
.
write
(
'%s
\
n
'
%
command_stderr
)
sys
.
exit
(
1
)
if
exit_code
!=
0
:
sys
.
exit
(
exit_code
)
print
'Fetching %s feed...'
%
args
.
feed_url
[
0
]
...
...
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