Applying Bionic repository profile doesn't work

Bug #1771443 reported by Alex Moldovan on 2018-05-15
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
High
Simon Poirier
landscape-client (Ubuntu)
High
Simon Poirier
Bionic
Medium
Simon Poirier

Bug Description

[Impact]

 * Users trying to apply changes to package profiles through landscape will get
   an error in the activity. This will result in incomplete apt source list on
   those clients.

 * This change add handling for both unicode and bytes contents for
   apt-sources-replace messages from landscape-server.

[Test Case]

 * install landscape-server-quickstart and landscape-api from ppa:landscape/17.03
 * create user, generate api key and export it in a shell
 * Import the mirror key
   $ curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0xC0B21F32' > mirror_key
   $ landscape-api import-gpg-key ubuntu-new-mirror-key ./mirror_key
 * Create a gpg key named sign-key, without passphrase:
   $ gpg --gen-key
   $ gpg -a -o sign-key --export-secret-key sign-key
   $ landscape-api import-gpg-key sign-key ./sign-key
 * Create a mirror and profile
   $ landscape-api create-distribution ubuntu
   $ landscape-api create-series --pockets security --components restricted --architectures amd64 --mirror-gpg-key ubuntu-new-mirror-key --gpg-key sign-key --mirror-uri http://archive.ubuntu.com/ubuntu/ --mirror-series bionic bionic-repo ubuntu
   $ landscape-api sync-mirror-pocket security bionic-repo ubuntu
   $ landscape-api create-repository-profile --description "This profile is for Bionic-security-restricted" bio-secu-restricted-profile
   $ landscape-api associate-repository-profile --all-computers bio-secu-restricted-profile

 * Create a bionic container or machine, and install landscape-client.
   $ echo | openssl s_client --connect landscape-server:443 | openssl x509 | tee /etc/landscape/server.crt
   $ landscape-config --silent --computer-title "My Web Server" --account-name standalone --url https://landscape-server/message-system --ping-url http://landscape-server/ping -k /etc/landscape/server.crt
 * Accept the client and repository activitiy. The profile should apply correctly.
   $ landscape-api accept-pending-computers 1
   $ landscape-api approve-activities type:ChangeRepositoryProfilesRequest
 * Update the repository profile. The activity should succeed with the fix,
   and the client should have a non-empty source file at
   /etc/apt/sources.list.d/landscape-bio-secu-restricted-profile.list
   $ landscape-api add-pockets-to-repository-profile bio-secu-restricted-profile security bionic-repo ubuntu

[LandscapeUpdates]

https://wiki.ubuntu.com/LandscapeUpdates

[Regression Potential]

 * This change tries to correct the issue as simply and locally as possible.

 * Further regressions are unlikely as the fix only adds a flag in case the
   content is not the expected type when writing.

 * No other functionality depends on this code path.

[Other Info]

 * Shouldn't the content always be str anyway? Yes, but messages which went
   through the broker before the python3 switch wouldn't be due previously
   implicit typing, thus the fact we need to handle both.
 * Shouldn't there be other messages with the same issue? There were, and
   they got caught before the 18.01 release.

[Original description]

Landscape can't apply Ubuntu 18.04 repository profiles.

Steps to reproduce:

1) Have the newest Ubuntu signing mirror key [C0B21F32] and your resign mirror key imported, and a registered 18.04 computer that has the tag "bionic-test".

2) Create a small repository:
$ landscape-api create-distribution ubuntu
$ landscape-api create-series --pockets security --components restricted --architectures amd64 --mirror-gpg-key ubuntu-new-mirror-key --gpg-key lds-repo-sign-key --mirror-uri http://archive.ubuntu.com/ubuntu/ --mirror-series bionic bionic-repo ubuntu

3) Initiate the sync:
$ landscape-api sync-mirror-pocket security bionic-repo ubuntu

4) Create a repository profile:
$ landscape-api create-repository-profile --description "This profile is for Bionic-security-restricted" bio-secu-restricted-profile

5) Associate the repository profile to the computer with the "bionic-test" tag:
$ landscape-api associate-repository-profile --tags bionic-test bio-secu-restricted-profile

6) Add the security pocket to the repository profile:
$ landscape-api add-pockets-to-repository-profile bio-secu-restricted-profile security bionic-repo ubuntu

The activity fails with "TypeError: a bytes-like object is required, not 'str'", and the landscape-bio-secu-restricted-profile.list file on the client is empty.

Changed in landscape:
importance: Undecided → High
Simon Poirier (simpoir) on 2018-05-16
Changed in landscape:
assignee: nobody → Simon Poirier (simpoir)
status: New → Triaged
status: Triaged → In Progress
Simon Poirier (simpoir) on 2018-05-18
Changed in landscape:
status: In Progress → Fix Committed
information type: Proprietary → Public
affects: landscape → landscape-client (Ubuntu)
Changed in landscape-client (Ubuntu):
status: Fix Committed → In Progress
status: In Progress → Confirmed
Changed in landscape-client:
status: New → Fix Committed
assignee: nobody → Simon Poirier (simpoir)
importance: Undecided → High
Simon Poirier (simpoir) wrote :
description: updated
description: updated
Simon Poirier (simpoir) wrote :
Eric Desrochers (slashd) on 2018-05-30
Changed in landscape-client (Ubuntu Bionic):
assignee: nobody → Simon Poirier (simpoir)
importance: Undecided → Medium
status: New → In Progress
Changed in landscape-client (Ubuntu):
status: Confirmed → In Progress
Eric Desrochers (slashd) wrote :

Sponsored in devel release (Cosmic), we can go ahead with the SRU once the package cosmic turn to "Fix Released".

description: updated
Eric Desrochers (slashd) wrote :

Addition note, might be a good idea to start target cosmic (as we are in the beginning of the cycle) to introduce an autopkgtest for landscape-client ?

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package landscape-client - 18.01-0ubuntu4

---------------
landscape-client (18.01-0ubuntu4) cosmic; urgency=medium

  * d/p/apt-sources-replace-1771443.patch:
    - Handle unicode in apt-sources-replace (LP: #1771443)

 -- Simon Poirier <email address hidden> Fri, 18 May 2018 15:29:00 +0000

Changed in landscape-client (Ubuntu):
status: In Progress → Fix Released
Eric Desrochers (slashd) wrote :

Sponsored for bionic.

Hello Alex, or anyone else affected,

Accepted landscape-client into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/landscape-client/18.01-0ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in landscape-client (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Alex Moldovan (alexmoldovan) wrote :

I've tested the client on Bionic and successfully added bionic repositories to it.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Robie Basak (racb) wrote :

What is the package version string of the successful test please?

Alex Moldovan (alexmoldovan) wrote :

landscape-client 18.01-0ubuntu3.1
landscape-common 18.01-0ubuntu3.1

And now /etc/apt/sources.list.d/landscape-bio-secu-restricted-profile.list is created properly:
deb http://ldsone.canonistack/repository/standalone/ubuntu bionic-repo-security

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package landscape-client - 18.01-0ubuntu3.1

---------------
landscape-client (18.01-0ubuntu3.1) bionic; urgency=medium

  * d/p/apt-sources-replace-1771443.patch:
    - Handle unicode in apt-sources-replace (LP: #1771443)

 -- Simon Poirier <email address hidden> Fri, 18 May 2018 15:29:00 +0000

Changed in landscape-client (Ubuntu Bionic):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for landscape-client has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

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

Other bug subscribers