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
e8c9dd92
Commit
e8c9dd92
authored
4 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Do not raise error when ubicast repository is not present
parent
e19bf60b
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/scripts/test_apt.py
+32
-36
32 additions, 36 deletions
tests/scripts/test_apt.py
with
32 additions
and
36 deletions
tests/scripts/test_apt.py
+
32
−
36
View file @
e8c9dd92
...
@@ -116,55 +116,51 @@ def main():
...
@@ -116,55 +116,51 @@ def main():
or
apt
.
is_installed
(
"
celerity-server
"
)
or
apt
.
is_installed
(
"
celerity-server
"
)
or
apt
.
is_installed
(
"
celerity-utils
"
)
or
apt
.
is_installed
(
"
celerity-utils
"
)
or
apt
.
is_installed
(
"
celerity-workers
"
)
or
apt
.
is_installed
(
"
celerity-workers
"
)
# older versions
or
apt
.
is_installed
(
"
python3-mediaserver
"
)
or
apt
.
is_installed
(
"
python3-mediaserver-monitor
"
)
or
apt
.
is_installed
(
"
campus-manager
"
)
else
False
else
False
)
)
if
ubicast_repo
and
ubicast_package
:
if
ubicast_repo
and
ubicast_package
:
lg
.
success
(
"
ubicast repository present
"
)
lg
.
success
(
"
ubicast repository present
"
)
elif
not
ubicast_repo
and
ubicast_package
:
elif
not
ubicast_repo
and
ubicast_package
:
lg
.
error
(
"
ubicast repository missing
"
)
lg
.
warning
(
"
ubicast repository missing
"
)
error
s
+=
1
warning
s
+=
1
elif
not
ubicast_repo
and
not
ubicast_package
:
elif
not
ubicast_repo
and
not
ubicast_package
:
lg
.
info
(
"
no ubicast repository and service installed
"
)
lg
.
info
(
"
no ubicast repository and service installed
"
)
return
2
else
:
else
:
lg
.
info
(
"
no ubicast service installed
"
)
lg
.
info
(
"
no ubicast service installed
"
)
# check ubicast repository url
if
ubicast_repo
:
regexp_repo
=
(
# check ubicast repository url
r
"
^deb (http[s]?://[A-Za-z0-9\.\-\_]+) packaging/apt/([A-Za-z0-9\.\-\_]+)/$
"
regexp_repo
=
(
)
r
"
^deb (http[s]?://[A-Za-z0-9\.\-\_]+) packaging/apt/([A-Za-z0-9\.\-\_]+)/$
"
repo_url_match
=
line_in_file
(
regexp_repo
,
"
/etc/apt/sources.list.d/skyreach.list
"
)
)
if
repo_url_match
:
repo_url_match
=
line_in_file
(
regexp_repo
,
"
/etc/apt/sources.list.d/skyreach.list
"
)
url
,
apt_token
=
repo_url_match
.
groups
()
if
repo_url_match
:
lg
.
success
(
"
url: {}, token: {}[...]
"
.
format
(
url
,
apt_token
[:
8
]))
url
,
apt_token
=
repo_url_match
.
groups
()
else
:
lg
.
success
(
"
url: {}, token: {}[...]
"
.
format
(
url
,
apt_token
[:
8
]))
url
,
apt_token
=
None
,
None
lg
.
error
(
"
incorrect ubicast repository url or token
"
)
errors
+=
1
# check server avalability
if
url
:
server_response
=
requests
.
get
(
url
,
verify
=
False
)
if
server_response
.
ok
:
lg
.
success
(
"
request to {} succeeded
"
.
format
(
url
))
else
:
else
:
lg
.
error
(
"
request to {} failed: {}
"
.
format
(
url
,
server_response
.
text
))
url
,
apt_token
=
None
,
None
lg
.
error
(
"
incorrect ubicast repository url or token
"
)
errors
+=
1
errors
+=
1
# check repository avalability
# check server avalability
if
url
and
apt_token
:
if
url
:
apt_url
=
"
{}/packaging/apt/{}/Packages
"
.
format
(
url
,
apt_token
)
server_response
=
requests
.
get
(
url
,
verify
=
False
)
repo_response
=
requests
.
get
(
apt_url
,
verify
=
False
)
if
server_response
.
ok
:
apt_url
=
"
{}/packaging/apt/{}[...]/Packages
"
.
format
(
url
,
apt_token
[:
8
])
lg
.
success
(
"
request to {} succeeded
"
.
format
(
url
))
if
repo_response
.
ok
:
else
:
lg
.
success
(
"
request to {} succeeded
"
.
format
(
apt_url
))
lg
.
error
(
"
request to {} failed: {}
"
.
format
(
url
,
server_response
.
text
))
else
:
errors
+=
1
lg
.
error
(
"
request to {} failed: {}
"
.
format
(
apt_url
,
repo_response
.
text
))
errors
+=
1
# check repository avalability
if
url
and
apt_token
:
apt_url
=
"
{}/packaging/apt/{}/Packages
"
.
format
(
url
,
apt_token
)
repo_response
=
requests
.
get
(
apt_url
,
verify
=
False
)
apt_url
=
"
{}/packaging/apt/{}[...]/Packages
"
.
format
(
url
,
apt_token
[:
8
])
if
repo_response
.
ok
:
lg
.
success
(
"
request to {} succeeded
"
.
format
(
apt_url
))
else
:
lg
.
error
(
"
request to {} failed: {}
"
.
format
(
apt_url
,
repo_response
.
text
))
errors
+=
1
if
errors
:
if
errors
:
return
1
return
1
...
...
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