← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:jammy-proxy into curtin:ubuntu/jammy

 

Dan Bungert has proposed merging ~dbungert/curtin:jammy-proxy into curtin:ubuntu/jammy.

Commit message:
Merge fix for Proxy

Cherry-pick b49f5b1505d6597a5c64e3220bb45a291d9a78f7

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/421598
-- 
Your team curtin developers is requested to review the proposed merge of ~dbungert/curtin:jammy-proxy into curtin:ubuntu/jammy.
diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
index 1dc0233..4f62a86 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)

Follow ups