Diff comments:

> diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
> index e7d84c0..7cb1484 100644
> --- a/curtin/commands/apt_config.py
> +++ b/curtin/commands/apt_config.py
> @@ -343,20 +343,22 @@ def apply_preserve_sources_list(target):
>          raise
>  
>  
> -def add_apt_key_raw(key, target=None):
> +def add_apt_key_raw(filename, key, target=None):
>      """
>      actual adding of a key as defined in key argument
>      to the system
>      """
>      LOG.debug("Adding key:\n'%s'", key)
> -    try:
> -        util.subp(['apt-key', 'add', '-'], data=key.encode(), target=target)
> -    except util.ProcessExecutionError:
> -        LOG.exception("failed to add apt GPG Key to apt keyring")
> -        raise
> +    if '-----BEGIN PGP PUBLIC KEY BLOCK-----' in key:
> +        target_file_ext = '.asc'
> +    else:
> +        target_file_ext = '.gpg'

The user does not specify this filename. This is the key filename, not the 
sources.list filename. I doubt anyone is specifying a sources.list filename 
ending in `*.gpg` or `*.asc`, but in either case, we already have to munge that 
to end in `*.list` in order for apt to see it elsewhere. This isn't that 
different, IMO. It is also the exact same change made already in other Ubuntu 
packages to support this functional change in `apt-key`. This particular 
suffixing rule is required by apt to understand how to parse the key.

> +    target_file = paths.target_path(target, filename + target_file_ext)
> +    util.write_file(target_file, key.rstrip(), mode=0o644)
> +    LOG.debug("Added key to '%s'", target_file)

Good point, doing it now.

>  
>  
> -def add_apt_key(ent, target=None):
> +def add_apt_key(filename, ent, target=None):
>      """
>      Add key to the system as defined in ent (if any).
>      Supports raw keys or keyid's


-- 
https://code.launchpad.net/~nacc/curtin/+git/curtin/+merge/393661
Your team curtin developers is subscribed to branch curtin:master.

-- 
Mailing list: https://launchpad.net/~curtin-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~curtin-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to