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

Added a step for apt cacher ng configuration (refs #21177).

parent a9451126
No related branches found
No related tags found
No related merge requests found
...@@ -27,17 +27,10 @@ def setup(interactive=True): ...@@ -27,17 +27,10 @@ def setup(interactive=True):
if https_proxy: if https_proxy:
apt_proxy += 'Acquire::https::Proxy "%s";\n' % https_proxy apt_proxy += 'Acquire::https::Proxy "%s";\n' % https_proxy
# apt-cacher-ng
apt_cacher_ng_conf_path = '/etc/apt-cacher-ng/acng.conf'
apt_cacher_ng_proxy = ''
if http_proxy:
apt_cacher_ng_proxy += 'Proxy: %s' % http_proxy
# write changes # write changes
files = ( files = (
(environment_path, environment), (environment_path, environment),
(apt_proxy_path, apt_proxy), (apt_proxy_path, apt_proxy),
(apt_cacher_ng_conf_path, apt_cacher_ng_proxy),
) )
for path, content in files: for path, content in files:
if os.path.exists(path): if os.path.exists(path):
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import utils
def setup(interactive=True):
http_proxy = utils.get_conf('PROXY_HTTP')
# apt-cacher-ng
path = '/etc/apt-cacher-ng/acng.conf'
if os.path.exists(path):
with open(path, 'r') as fo:
current_conf = fo.read()
new_conf = re.sub(r'\nProxy:.*', '', current_conf).strip() + '\n'
if http_proxy:
new_conf += '\nProxy: %s\n' % http_proxy
if current_conf != new_conf:
with open(path, 'w') as fo:
fo.write(new_conf)
utils.log('File "%s" updated.' % path)
else:
utils.log('File "%s" already up to date.' % path)
...@@ -56,6 +56,7 @@ campusmanager() { ...@@ -56,6 +56,7 @@ campusmanager() {
python3 /root/envsetup/envsetup.py 23 python3 /root/envsetup/envsetup.py 23
python3 /root/envsetup/envsetup.py 25 python3 /root/envsetup/envsetup.py 25
python3 /root/envsetup/envsetup.py 61 python3 /root/envsetup/envsetup.py 61
python3 /root/envsetup/envsetup.py 62
python3 /root/envsetup/envsetup.py 25 python3 /root/envsetup/envsetup.py 25
} }
......
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