diff options
author | Olivier Gayot <[email protected]> | 2022-04-27 18:55:18 +0200 |
---|---|---|
committer | Dan Bungert <[email protected]> | 2022-05-06 09:07:18 -0600 |
commit | 15ecdeab1e3a41069e84ddcac42d8bd1747e0382 (patch) | |
tree | 507dfb7b8a9f8fbc77e62b54b53ebeae0d1f025e | |
parent | a74424850379e2cd2e19b437a3f0e60aae374958 (diff) |
Make sure curthooks do not discard supplied proxy settingsubuntu/jammy
Just like we witnessed for the APT preferences, the proxy settings are
not honored when Subiquity installs packages from the "packages"
autoinstall section. This also applies for unattended-upgrades.
This happened because the installation of packages and execution of
unattended-upgrades occur after running curthooks.
Curtooks call handle_apt with an almost empty configuration.
Therefore, we would discard the proxy settings by removing the
etc/apt/apt.conf.d/90curtin-aptproxy file.
Fixed by not removing etc/apt/preferences.d/90curtin.pref when the
configuration does not contain APT preferences.
Signed-off-by: Olivier Gayot <[email protected]>
-rw-r--r-- | curtin/commands/apt_config.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py index 1dc02334..4f62a86f 100644 --- a/curtin/commands/apt_config.py +++ b/curtin/commands/apt_config.py @@ -579,7 +579,7 @@ def find_apt_mirror_info(cfg, arch=None): def apply_apt_proxy_config(cfg, proxy_fname, config_fname): """apply_apt_proxy_config - Applies any apt*proxy config from if specified + Applies any apt*proxy from config if specified """ # Set up any apt proxy cfgs = (('proxy', 'Acquire::http::Proxy "%s";'), @@ -592,8 +592,14 @@ def apply_apt_proxy_config(cfg, proxy_fname, config_fname): LOG.debug("write apt proxy info to %s", proxy_fname) util.write_file(proxy_fname, '\n'.join(proxies) + '\n') elif os.path.isfile(proxy_fname): - util.del_file(proxy_fname) - LOG.debug("no apt proxy configured, removed %s", proxy_fname) + # When $ curtin apt-config is called with no proxy set, it makes + # sense to remove the proxy file (if present). Having said that, + # this code is also called automatically at the curthooks stage with an + # empty configuration. Since the installation of external packages and + # execution of unattended-upgrades (which happen after executing the + # curthooks) need to use the proxy if specified, we must not let the + # curthooks remove the proxy file. + pass if cfg.get('conf', None): LOG.debug("write apt config info to %s", config_fname) |