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
Kirill Smelkov
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 @@
...
@@ -4,7 +4,6 @@
import
argparse
import
argparse
import
csv
import
csv
import
httplib
import
httplib
import
os
import
socket
import
socket
import
subprocess
import
subprocess
import
sys
import
sys
...
@@ -32,28 +31,23 @@ def main():
...
@@ -32,28 +31,23 @@ def main():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
with
open
(
os
.
devnull
)
as
devnull
:
try
:
command
=
subprocess
.
Popen
(
args
.
executable
[
0
],
content
=
subprocess
.
check_output
(
stdin
=
subprocess
.
PIPE
,
args
.
executable
[
0
],
stdout
=
devnull
,
stderr
=
subprocess
.
STDOUT
stderr
=
subprocess
.
PIPE
,
)
close_fds
=
True
)
exit_code
=
0
command
.
stdin
.
flush
()
except
subprocess
.
CalledProcessError
as
e
:
command
.
stdin
.
close
()
content
=
e
.
output
exit_code
=
e
.
returncode
command_failed
=
(
command
.
wait
()
!=
0
)
command_stderr
=
command
.
stderr
.
read
()
print
content
if
command_failed
:
content
+=
(
"
\
n
<p>Failed with returncode <em>%d</em>.</p>"
content
=
(
"<p>Failed with returncode <em>%d</em>.</p>"
"<p>Output is: </p><pre>%s</pre>"
%
(
"<p>Standard error output is :</p><pre>%s</pre>"
)
%
(
exit_code
,
command
.
poll
(),
content
.
replace
(
'&'
,
'&'
).
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
)
command_stderr
.
replace
(
'&'
,
'&'
)
\
))
.
replace
(
'<'
,
'<'
)
\
.
replace
(
'>'
,
'>'
),
)
else
:
content
=
"<p>Everything went well.</p>"
with
open
(
args
.
logfile
[
0
],
'a'
)
as
file_
:
with
open
(
args
.
logfile
[
0
],
'a'
)
as
file_
:
cvsfile
=
csv
.
writer
(
file_
)
cvsfile
=
csv
.
writer
(
file_
)
...
@@ -64,9 +58,8 @@ def main():
...
@@ -64,9 +58,8 @@ def main():
'slapos:%s'
%
uuid
.
uuid4
(),
'slapos:%s'
%
uuid
.
uuid4
(),
])
])
if
command_failed
:
if
exit_code
!=
0
:
sys
.
stderr
.
write
(
'%s
\
n
'
%
command_stderr
)
sys
.
exit
(
exit_code
)
sys
.
exit
(
1
)
print
'Fetching %s feed...'
%
args
.
feed_url
[
0
]
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