Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
DNS testing tools
Remoh
Commits
50a0c81a
Commit
50a0c81a
authored
Mar 27, 2020
by
Alexandre
Browse files
Check on loop with broken IPs: set it as KO and output on stderr
parent
07d41e87
Changes
2
Hide whitespace changes
Inline
Side-by-side
homer.py
View file @
50a0c81a
...
...
@@ -76,17 +76,19 @@ mandatory_levels = {"legal": 30, "necessary": 20, "nicetohave": 10}
TIMEOUT_CONN
=
2
def
error
(
msg
=
None
):
def
error
(
msg
=
None
,
exit
=
True
):
if
msg
is
None
:
msg
=
"Unknown error"
if
monitoring
:
print
(
"%s: %s"
%
(
url
,
msg
))
sys
.
exit
(
STATE_CRITICAL
)
if
exit
:
sys
.
exit
(
STATE_CRITICAL
)
else
:
print
(
msg
,
file
=
sys
.
stderr
)
if
check
:
print
(
'KO'
)
sys
.
exit
(
1
)
if
exit
:
sys
.
exit
(
1
)
def
usage
(
msg
=
None
):
if
msg
:
...
...
@@ -331,8 +333,7 @@ class ConnectionDoT(Connection):
if
connect
is
None
:
error
(
f
'Could not connect to "
{
server
}
"'
)
else
:
if
self
.
verbose
:
print
(
f
'Could not connect to "
{
server
}
" on
{
connect
}
'
)
error
(
f
'Could not connect to "
{
server
}
" on
{
connect
}
'
,
exit
=
False
)
def
connect
(
self
,
addr
,
sock_family
):
...
...
@@ -912,6 +913,7 @@ for connectTo in ip_set:
except
CustomException
as
e
:
error
(
e
)
if
conn
.
dot
and
not
conn
.
success
:
ok
=
False
continue
if
ifile
is
not
None
:
input
=
open
(
ifile
)
...
...
tests.yaml
View file @
50a0c81a
...
...
@@ -288,8 +288,8 @@ tests:
-
'
--dot'
-
'
brok.sources.org'
-
'
in'
stderr
:
'
'
partstdout
:
"
O
K
\n
"
part
stderr
:
'
Could
not
connect
to
'
partstdout
:
"
K
O
\n
"
###############################################################################
...
...
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