[Merge] ~mitchburton/ubuntu/+source/landscape-client:ubuntu/lunar-devel into ubuntu/+source/landscape-client:ubuntu/lunar-devel

Kevin Nasto mp+437634 at code.launchpad.net
Thu Feb 23 21:10:19 UTC 2023



Diff comments:

> diff --git a/landscape/client/manager/aptsources.py b/landscape/client/manager/aptsources.py
> index 649569b..866c6ba 100644
> --- a/landscape/client/manager/aptsources.py
> +++ b/landscape/client/manager/aptsources.py
> @@ -83,16 +85,12 @@ class AptSources(ManagerPlugin):
>                        "-----END PGP PUBLIC KEY BLOCK-----"]}
>          """
>          deferred = succeed(None)
> +        prefix = 'landscape-server-'
>          for key in message["gpg-keys"]:
> -            fd, path = tempfile.mkstemp()
> -            os.close(fd)
> -            with open(path, "w") as key_file:
> +            filename = prefix + str(uuid.uuid4()) + '.asc'

There can be multiple keys sent from landscape server, they are not named. One option I considered was calculating the fingerprint but this required an additional dependency.

> +            key_path = os.path.join(self.TRUSTED_GPG_D, filename)
> +            with open(key_path, "w") as key_file:
>                  key_file.write(key)
> -            deferred.addCallback(
> -                lambda ignore, path=path:
> -                    self._run_process("/usr/bin/apt-key", ["add", path]))
> -            deferred.addCallback(self._handle_process_error)
> -            deferred.addBoth(self._remove_and_continue, path)
>          deferred.addErrback(self._handle_process_failure)
>          deferred.addCallback(self._handle_sources, message["sources"])
>          return self.call_with_operation_result(message, lambda: deferred)


-- 
https://code.launchpad.net/~mitchburton/ubuntu/+source/landscape-client/+git/landscape-client/+merge/437634
Your team Ubuntu Sponsors Team is requested to review the proposed merge of ~mitchburton/ubuntu/+source/landscape-client:ubuntu/lunar-devel into ubuntu/+source/landscape-client:ubuntu/lunar-devel.





More information about the Ubuntu-sponsors mailing list