install_sources added before install_keys making apt update fail

Bug #1830385 reported by David Coronel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Charm
New
Undecided
Unassigned

Bug Description

During deployment of the landscape-server charm, when using both install_sources and install_keys, the install_sources get added before the install_keys and apt update runs without the apt key making the update fail, which then makes the apt install of landscape-server fail because it doesn't know where to find the package.

Observed errors in unit-landscape-server-0:

INFO unit.landscape-server/0.juju-log Invoke handler for install
INFO unit.landscape-server/0.juju-log Invoking charm-pre-install hooks
DEBUG unit.landscape-server/0.install Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
DEBUG unit.landscape-server/0.install Get:2 http://ppa.launchpad.net/landscape/19.01/ubuntu bionic InRelease [15.4 kB]
DEBUG unit.landscape-server/0.install Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
DEBUG unit.landscape-server/0.install Hit:4 http://archive.ubuntu.com/ubuntu bionic-security InRelease
DEBUG unit.landscape-server/0.install Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
DEBUG unit.landscape-server/0.install Err:2 http://ppa.launchpad.net/landscape/19.01/ubuntu bionic InRelease
DEBUG unit.landscape-server/0.install The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6E85A86E4652B4E6
DEBUG unit.landscape-server/0.install Reading package lists...
DEBUG unit.landscape-server/0.install W: GPG error: http://ppa.launchpad.net/landscape/19.01/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6E85A86E4652B4E6
DEBUG unit.landscape-server/0.install E: The repository 'http://ppa.launchpad.net/landscape/19.01/ubuntu bionic InRelease' is not signed.
INFO unit.landscape-server/0.juju-log Failed executing 'add-apt-repository --yes deb http://ppa.launchpad.net/landscape/19.01/ubuntu bionic main'. Will retry in 10 seconds
DEBUG unit.landscape-server/0.install Warning: apt-key output should not be parsed (stdout is not a terminal)
DEBUG unit.landscape-server/0.install OK
INFO unit.landscape-server/0.juju-log Installing ('landscape-server', 'landscape-hashids', 'python-minimal', 'python-psutil') with options: ['--option=Dpkg::Options::=--force-confold']
DEBUG unit.landscape-server/0.install Reading package lists...
DEBUG unit.landscape-server/0.install Building dependency tree...
DEBUG unit.landscape-server/0.install Reading state information...
DEBUG unit.landscape-server/0.install E: Unable to locate package landscape-server
DEBUG unit.landscape-server/0.install E: Unable to locate package landscape-hashids
INFO unit.landscape-server/0.juju-log Couldn't acquire DPKG lock. Will retry in 10 seconds

Example charm yaml:

  landscape-server:
    charm: cs:landscape-server
    options:
      install_sources: |
        - 'deb http://ppa.launchpad.net/landscape/19.01/ubuntu bionic main'
      install_keys: |-
        - |
          -----BEGIN PGP PUBLIC KEY BLOCK-----
          Version: SKS 1.1.6
          Comment: Hostname: keyserver.ubuntu.com

          mI0ESXN/egEEAOgRYISU9dnQm4BB5ZEEwKT+NKUDNd/DhMYdtBMw9Yk7S5cyoqpbtwoPJVzK
          AXxq+ng5e3yYypSv98pLMr5UF09FGaeyGlD4s1uaVFWkFCO4jsTg7pWIY6qzO/jMxB5+Yu/G
          0GjWQMNKxFk0oHMa0PhNBZtdPacVz65mOVmCsh/lABEBAAG0G0xhdW5jaHBhZCBQUEEgZm9y
          IExhbmRzY2FwZYi2BBMBAgAgBQJJc396AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ
          boWobkZStOb+rwP+ONKUWeX+MTIPqGWkknBPV7jm8nyyIUojC4IhS+9YR6GYnn0hMABSkEHm
          IV73feKmrT2GESYI1UdYeKiOkWsPN/JyBk+eTvKet0qsw5TluqiHSW+LEi/+zUyrS3dDMX3o
          yaLgYa+UkjIyxnaKLkQuCiS+D+fYwnJulIkhaKObtdE=
          =UwRd
          -----END PGP PUBLIC KEY BLOCK-----

Eventually this is retried by Juju and it works on further attempts because the apt key is now imported. However this causes the landscape-server unit to fail with an error in the workload status.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.