Skip to content
Snippets Groups Projects
Commit e8c9dd92 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

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
...@@ -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")
errors += 1 warnings += 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment