Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
a0c47c49
Commit
a0c47c49
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Changed DNS log.
parent
cc33a9c8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_dns_records.py
+9
-10
9 additions, 10 deletions
tests/test_dns_records.py
with
9 additions
and
10 deletions
tests/test_dns_records.py
+
9
−
10
View file @
a0c47c49
...
...
@@ -28,27 +28,26 @@ resolvers = get_dns_servers()
def
get_result
(
output
):
for
line
in
output
.
split
(
'
\n
'
):
if
"
has address
"
in
line
:
return
line
.
split
(
"
has address
"
)[
1
]
if
'
has address
'
in
line
:
return
line
.
split
(
'
has address
'
)[
1
]
def
check_dns
(
hostname
,
expected_ip
):
all_ok
=
True
for
resolver
in
resolvers
:
status
,
output
=
subprocess
.
getstatusoutput
(
"
host %s %s
"
%
(
hostname
,
resolver
))
success
=
(
status
==
0
)
if
success
:
status
,
output
=
subprocess
.
getstatusoutput
(
'
host
"
%s
"
"
%s
"'
%
(
hostname
,
resolver
))
if
status
==
0
:
color
=
GREEN
address
=
get_result
(
output
)
if
address
!=
expected_ip
:
print
(
'
Expected ip was: %s, got %s
'
%
(
expected_ip
,
address
))
print
(
'
Expected ip was:
"
%s
"
, got
"
%s
"
.
'
%
(
expected_ip
,
address
))
color
=
RED
all_ok
=
False
else
:
color
=
RED
all_ok
=
False
address
=
"
FAIL
"
print
(
'
%sDNS resolution of %s on server %s returned %s%s
'
%
(
color
,
hostname
,
resolver
,
address
,
DEF
))
address
=
'
FAIL
'
print
(
'
%sDNS resolution of
"
%s
"
on server
"
%s
"
returned
"
%s
"
.
%s
'
%
(
color
,
hostname
,
resolver
,
address
,
DEF
))
return
all_ok
...
...
@@ -68,7 +67,7 @@ conf_resolvers_keys = (
for
conf_resolver_key
in
conf_resolvers_keys
:
conf_resolver
=
conf
.
get
(
conf_resolver_key
)
if
conf_resolver
and
conf_resolver
!=
'
0
'
and
conf_resolver
not
in
resolvers
:
print
(
'
Resolver %s not configured on the system
'
%
conf_resolver
)
print
(
'
Resolver %s not configured on the system
.
'
%
conf_resolver
)
all_ok
=
False
ip
=
conf
.
get
(
'
NETWORK_IP_NAT
'
)
...
...
@@ -77,7 +76,7 @@ if not ip or ip == '0':
if
not
ip
or
ip
==
'
0
'
:
if
not
all_ok
:
sys
.
exit
(
1
)
# cannot test resolution IP
print
(
'
No IP set in configuration file, unable to test DNS.
'
)
sys
.
exit
(
2
)
conf_servers
=
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment