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
Eric Zheng
slapos.toolbox
Commits
941774fe
Commit
941774fe
authored
Sep 02, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
networkbench: Fix access to https and standarlize csv output
parent
3a48feda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
slapos/networkbench.py
slapos/networkbench.py
+8
-3
No files found.
slapos/networkbench.py
View file @
941774fe
...
@@ -83,6 +83,10 @@ def _test_url_request(url):
...
@@ -83,6 +83,10 @@ def _test_url_request(url):
curl
.
setopt
(
curl
.
CONNECTTIMEOUT
,
10
)
curl
.
setopt
(
curl
.
CONNECTTIMEOUT
,
10
)
curl
.
setopt
(
curl
.
TIMEOUT
,
300
)
curl
.
setopt
(
curl
.
TIMEOUT
,
300
)
curl
.
setopt
(
curl
.
WRITEDATA
,
buffer
)
curl
.
setopt
(
curl
.
WRITEDATA
,
buffer
)
curl
.
setopt
(
curl
.
SSL_VERIFYPEER
,
False
)
curl
.
setopt
(
curl
.
SSL_VERIFYHOST
,
False
)
result
=
"OK"
try
:
try
:
curl
.
perform
()
curl
.
perform
()
...
@@ -90,10 +94,11 @@ def _test_url_request(url):
...
@@ -90,10 +94,11 @@ def _test_url_request(url):
import
traceback
import
traceback
traceback
.
print_exc
(
file
=
sys
.
stderr
)
traceback
.
print_exc
(
file
=
sys
.
stderr
)
sys
.
stderr
.
flush
()
sys
.
stderr
.
flush
()
result
=
"FAIL"
body
=
buffer
.
getvalue
()
body
=
buffer
.
getvalue
()
rendering_time
=
"%s
/%s/%s/%s/
%s"
%
\
rendering_time
=
"%s
;%s;%s;%s;
%s"
%
\
(
curl
.
getinfo
(
curl
.
NAMELOOKUP_TIME
),
(
curl
.
getinfo
(
curl
.
NAMELOOKUP_TIME
),
curl
.
getinfo
(
curl
.
CONNECT_TIME
),
curl
.
getinfo
(
curl
.
CONNECT_TIME
),
curl
.
getinfo
(
curl
.
PRETRANSFER_TIME
),
curl
.
getinfo
(
curl
.
PRETRANSFER_TIME
),
...
@@ -104,7 +109,7 @@ def _test_url_request(url):
...
@@ -104,7 +109,7 @@ def _test_url_request(url):
curl
.
close
()
curl
.
close
()
info_list
=
(
'GET'
,
url
,
response_code
,
rendering_time
,
"OK"
)
info_list
=
(
'GET'
,
url
,
response_code
,
rendering_time
,
result
)
return
info_list
return
info_list
...
@@ -188,7 +193,7 @@ def create_logger(name, log_folder):
...
@@ -188,7 +193,7 @@ def create_logger(name, log_folder):
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
shell
=
True
)
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
shell
=
True
)
sp
.
communicate
()
sp
.
communicate
()
format
=
"%%(asctime)-16s;%
%(levelname)s;%
s;%%(message)s"
%
botname
format
=
"%%(asctime)-16s;%s;%%(message)s"
%
botname
handler
.
setFormatter
(
logging
.
Formatter
(
format
))
handler
.
setFormatter
(
logging
.
Formatter
(
format
))
new_logger
.
addHandler
(
handler
)
new_logger
.
addHandler
(
handler
)
return
new_logger
return
new_logger
...
...
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