← Back to team overview

curtin-dev team mailing list archive

[Merge] curtin:revert-curthooks-apt-config-hacks into curtin:master

 

Olivier Gayot has proposed merging curtin:revert-curthooks-apt-config-hacks into curtin:master.

Commit message:
Revert "Make sure curthooks do not discard supplied proxy settings"

This reverts commit b49f5b1505d6597a5c64e3220bb45a291d9a78f7.


Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~curtin-dev/curtin/+git/curtin/+merge/438190

This is a revert of two patches that were introduced to work around an issue causing some of subiquity's apt-config settings to be overwritten at the curthooks stage.

The root cause was addressed by:
* fixing the translate_old_apt_features function called by curtin as part of curthooks. The function used to accidentally coerce the configuration into something that would trigger curtin's apt-config unconditionally. https://code.launchpad.net/~ogayot/curtin/+git/curtin/+ref/curthooks-fix-apt-config-translation

* making sure subiquity provides debconf-selections settings as part of apt-config and not as
part of the curthooks stage. https://github.com/canonical/subiquity/pull/1565
-- 
Your team curtin developers is requested to review the proposed merge of curtin:revert-curthooks-apt-config-hacks into curtin:master.
diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
index e02327a..0b8066b 100644
--- a/curtin/commands/apt_config.py
+++ b/curtin/commands/apt_config.py
@@ -601,14 +601,8 @@ 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):
-        # 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
+        util.del_file(proxy_fname)
+        LOG.debug("no apt proxy configured, removed %s", proxy_fname)
 
     if cfg.get('conf', None):
         LOG.debug("write apt config info to %s", config_fname)
@@ -638,12 +632,9 @@ def apply_apt_preferences(cfg, pref_fname):
 
     prefs = cfg.get("preferences")
     if not prefs:
-        # When $ curtin apt-config is called with no preferences set, it makes
-        # sense to remove the preferences file (if present). Having said that,
-        # this code is also called automatically at the curthooks stage with an
-        # empty configuration. Since the installation of packages (which
-        # happens after executing the curthooks) needs to honor the preferences
-        # set, we must not let the curthooks remove the preferences file.
+        if os.path.isfile(pref_fname):
+            util.del_file(pref_fname)
+            LOG.debug("no apt preferences configured, removed %s", pref_fname)
         return
     prefs_as_strings = [preference_to_str(pref) for pref in prefs]
     LOG.debug("write apt preferences info to %s.", pref_fname)

Follow ups