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

Fixed skyreach APT reg exp | refs #29163

parent ddf83b6c
No related branches found
No related tags found
No related merge requests found
...@@ -37,19 +37,19 @@ with open(apt_source, 'r') as fo: ...@@ -37,19 +37,19 @@ with open(apt_source, 'r') as fo:
# # skyreach repo # # skyreach repo
# deb https://panel.ubicast.eu packaging/apt/s0000000000000000000000000000000/ # deb https://panel.ubicast.eu packaging/apt/s0000000000000000000000000000000/
expected = r'^deb (http[s]{0,1}://[A-Za-z0-9\.\-\_]+) packaging/apt/([A-Za-z0-9]+)/$' expected = r'^deb (http[s]{0,1}://[A-Za-z0-9\.\-\_]+) packaging/apt/([A-Za-z0-9\.\-\_]+)/$'
url = None url = None
api_key = None apt_token = None
if content: if content:
for line in content.split('\n'): for line in content.split('\n'):
m = re.match(expected, line) m = re.match(expected, line)
if m: if m:
url, api_key = m.groups() url, apt_token = m.groups()
if not url or not api_key: if not url or not apt_token:
print('The file "%s" is not correct: skyreach url not found.' % apt_source) print('The file "%s" is not correct: skyreach url not found.' % apt_source)
sys.exit(1) sys.exit(1)
print('SkyReach url is %s and API key is %s[...].' % (url, api_key[:8])) print('SkyReach url is %s and API key is %s[...].' % (url, apt_token[:8]))
# Test SkyReach responses # Test SkyReach responses
req = requests.get(url, verify=False) req = requests.get(url, verify=False)
...@@ -60,9 +60,9 @@ if not req.ok: ...@@ -60,9 +60,9 @@ if not req.ok:
else: else:
print('Request to %s: OK.' % url) print('Request to %s: OK.' % url)
apt_url = '%s/packaging/apt/%s/Packages' % (url, api_key) apt_url = '%s/packaging/apt/%s/Packages' % (url, apt_token)
req = requests.get(apt_url, verify=False) req = requests.get(apt_url, verify=False)
apt_url = apt_url.replace(api_key, api_key[:8] + '[...]') apt_url = apt_url.replace(apt_token, apt_token[:8] + '[...]')
if not req.ok: if not req.ok:
print('Request to %s failed (%s):' % (apt_url, req.status_code)) print('Request to %s failed (%s):' % (apt_url, req.status_code))
print(req.text) print(req.text)
......
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