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
e0f47775
Verified
Commit
e0f47775
authored
5 years ago
by
Nicolas KAROLAK
Browse files
Options
Downloads
Patches
Plain Diff
check that wowza listen on configured port | refs
#28832
parent
32f18ad1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkgs_envsetup.py
+7
-1
7 additions, 1 deletion
pkgs_envsetup.py
tests/test_wowza.py
+39
-0
39 additions, 0 deletions
tests/test_wowza.py
with
46 additions
and
1 deletion
pkgs_envsetup.py
+
7
−
1
View file @
e0f47775
...
...
@@ -2,7 +2,13 @@
from
subprocess
import
call
,
DEVNULL
PACKAGES
=
[
"
python3-openssl
"
,
"
python3-psutil
"
,
"
python3-requests
"
,
"
python3-spf
"
]
PACKAGES
=
[
"
python3-defusedxml
"
,
"
python3-openssl
"
,
"
python3-psutil
"
,
"
python3-requests
"
,
"
python3-spf
"
,
]
def
main
():
...
...
This diff is collapsed.
Click to expand it.
tests/test_wowza.py
+
39
−
0
View file @
e0f47775
...
...
@@ -10,6 +10,9 @@ import re
import
subprocess
# nosec: B404
import
sys
from
defusedxml.ElementTree
import
parse
from
psutil
import
net_connections
sys
.
path
.
append
(
str
(
Path
(
__file__
).
parents
[
1
].
resolve
()))
# pylint: disable=wrong-import-position
...
...
@@ -50,6 +53,13 @@ def main():
elif
check_warn
:
warnings
+=
1
# check that wowza is listening
check_warn
,
check_err
=
check_listening
()
if
check_err
:
errors
+=
1
elif
check_warn
:
warnings
+=
1
if
errors
:
exit
(
1
)
elif
warnings
:
...
...
@@ -152,5 +162,34 @@ def check_running() -> tuple:
return
warnings
,
errors
def
check_listening
()
->
tuple
:
"""
Check that Wowza is listening on configured port.
:return: Exit return codes
:rtype: bool
"""
warnings
=
0
errors
=
0
# get port number in Wowza config
conf
=
parse
(
"
/usr/local/WowzaStreamingEngine/conf/VHost.xml
"
).
getroot
()
port
=
conf
.
findall
(
"
VHost/HostPortList/HostPort/Port
"
)[
0
].
text
# get listening ports
listening
=
set
(
c
.
laddr
.
port
for
c
in
net_connections
(
kind
=
"
inet
"
)
if
c
.
status
==
"
LISTEN
"
)
# check that system is listening on this port
if
int
(
port
)
not
in
listening
:
u
.
error
(
"
not listening on port {}
"
.
format
(
port
))
errors
+=
1
else
:
u
.
success
(
"
listening on port {}
"
.
format
(
port
))
return
warnings
,
errors
if
__name__
==
"
__main__
"
:
main
()
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