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
294b54fd
Commit
294b54fd
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Added a conf to ignore domain resolution check (refs
#20802
).
parent
75fa2f0a
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_nginx_vhosts.py
+19
-6
19 additions, 6 deletions
tests/test_nginx_vhosts.py
with
19 additions
and
6 deletions
tests/test_nginx_vhosts.py
+
19
−
6
View file @
294b54fd
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
Criticality: High
Criticality: High
Tests that all webserver services (vhosts) are available and reachable.
Tests that all webserver services (vhosts) are available and reachable.
'''
'''
import
imp
import
os
import
os
import
re
import
re
import
requests
import
requests
...
@@ -31,23 +32,31 @@ if not os.path.exists(wowza_dir):
...
@@ -31,23 +32,31 @@ if not os.path.exists(wowza_dir):
else
:
else
:
print
(
'
Info: Wowza is installed, /streaming/ will be tested on mediaserver vhosts.
'
)
print
(
'
Info: Wowza is installed, /streaming/ will be tested on mediaserver vhosts.
'
)
# get envsetup conf
conf
=
dict
()
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
if
os
.
path
.
isfile
(
'
../utils.py
'
):
es_utils
=
imp
.
load_source
(
'
es_utils
'
,
'
../utils.py
'
)
conf
=
es_utils
.
load_conf
()
# get enabled vhosts
# get enabled vhosts
resolution_ignored
=
conf
.
get
(
'
TESTER_VHOST_RESOLUTION_IGNORED
'
,
''
).
split
(
'
,
'
)
requests
.
packages
.
urllib3
.
disable_warnings
()
requests
.
packages
.
urllib3
.
disable_warnings
()
found
=
False
found
=
False
errors
=
0
errors
=
0
for
name
in
os
.
listdir
(
nginx_dir
):
for
name
in
os
.
listdir
(
nginx_dir
):
path
=
os
.
path
.
join
(
nginx_dir
,
name
)
path
=
os
.
path
.
join
(
nginx_dir
,
name
)
with
open
(
path
,
'
r
'
)
as
fo
:
with
open
(
path
,
'
r
'
)
as
fo
:
conf
=
fo
.
read
()
vhost
=
fo
.
read
()
conf
=
conf
.
replace
(
'
\t
'
,
'
'
)
vhost
=
vhost
.
replace
(
'
\t
'
,
'
'
)
matching
=
re
.
search
(
r
'
.*server_name\ +([0-9a-zA-Z\.\-\_\ ]+);.*
'
,
conf
)
matching
=
re
.
search
(
r
'
.*server_name\ +([0-9a-zA-Z\.\-\_\ ]+);.*
'
,
vhost
)
if
not
matching
:
if
not
matching
:
print
(
'
The server_name was not found in:
"
%s
"
.
'
%
path
)
print
(
'
The server_name was not found in:
"
%s
"
.
'
%
path
)
errors
+=
1
errors
+=
1
continue
continue
domains
=
matching
.
groups
()[
0
].
strip
().
split
(
'
'
)
domains
=
matching
.
groups
()[
0
].
strip
().
split
(
'
'
)
https
=
re
.
search
(
r
'
listen +\w* +ssl;
'
,
conf
)
is
not
None
\
https
=
re
.
search
(
r
'
listen +\w* +ssl;
'
,
vhost
)
is
not
None
\
or
re
.
search
(
r
'
ssl +on;
'
,
conf
)
is
not
None
or
re
.
search
(
r
'
ssl +on;
'
,
vhost
)
is
not
None
for
domain
in
domains
:
for
domain
in
domains
:
if
domain
==
'
localhost
'
:
if
domain
==
'
localhost
'
:
continue
# status vhost
continue
# status vhost
...
@@ -65,7 +74,11 @@ for name in os.listdir(nginx_dir):
...
@@ -65,7 +74,11 @@ for name in os.listdir(nginx_dir):
ip_error
=
'
domain is resolved with %s instead of 127.0.0.1
'
%
ip
ip_error
=
'
domain is resolved with %s instead of 127.0.0.1
'
%
ip
sys
.
stdout
.
write
(
'
IP:
'
)
sys
.
stdout
.
write
(
'
IP:
'
)
if
ip_error
:
if
ip_error
:
sys
.
stdout
.
write
(
'
\033
[91mKO (%s)
\033
[0m
'
%
ip_error
)
if
domain
in
resolution_ignored
:
sys
.
stdout
.
write
(
'
\033
[94mIgnored (%s)
\033
[0m
'
%
ip_error
)
ip_error
=
None
else
:
sys
.
stdout
.
write
(
'
\033
[91mKO (%s)
\033
[0m
'
%
ip_error
)
else
:
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (127.0.0.1)
\033
[0m
'
)
sys
.
stdout
.
write
(
'
\033
[92mOK (127.0.0.1)
\033
[0m
'
)
# test url
# test url
...
...
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