← Back to team overview

curtin-dev team mailing list archive

[Merge] ~ogayot/curtin:curthooks-fix-apt-config-translation into curtin:master

 

The proposal to merge ~ogayot/curtin:curthooks-fix-apt-config-translation into curtin:master has been updated.

Description changed to:

The conditional execution of apt_config.handle_apt from curthooks builtins has been broken for a while. A regression was introduced in 2016 when adding a mechanism to translate things like:

```
                                  apt:
    debconf_selections:    =>       debconf_selections:
      foobar                          foobar
```

The function responsible for calling handle_apt is as follows:

def do_apt_config(cfg, target):
    cfg = apt_config.translate_old_apt_features(cfg)
    apt_cfg = cfg.get("apt")
    if apt_cfg is not None:
        LOG.info("curthooks handling apt to target %s with config %s",
                 target, apt_cfg)
        apt_config.handle_apt(apt_cfg, target)
    else:
        LOG.info("No apt config provided, skipping")

Sadly, the implementation of translate_old_apt_features made is so that the `if apt_cfg is not None:` condition is always true.

This first patch fixes the issue by making sure the translate_old_apt_features function only creates an 'apt' key and assign it a dictionary, if necessary. This also covers the functions with unit tests.

The second patch also fixes an obvious mistake in a debug log.

For more details, see:
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/437494
-- 
Your team curtin developers is requested to review the proposed merge of ~ogayot/curtin:curthooks-fix-apt-config-translation into curtin:master.



References