apt-add-repository requires --login for private repos, breaking automated workflows

Bug #1965180 reported by John Chittum
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Fix Released
High
Brian Murray
Jammy
Fix Released
High
Brian Murray

Bug Description

On Focal, in an automated environment (such as a launchpad builder), a used can do the following workflow:

curl "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${FINGERPRINT}" --output /etc/apt/trusted.gpg.d/${FINGERPRINT}.asc

apt-add-repository "deb https://${USERNAME}:${PASSWORD}@private-ppa.launchpad.net/${REPO}/ubuntu focal main"

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:5 https://private-ppa.launchpad.net/$REPO/ubuntu focal InRelease [24.3 kB]
Get:6 https://private-ppa.launchpad.net/$REPO/ubuntu focal/main amd64 Packages [3288 B]
Get:7 https://private-ppa.launchpad.net/$REPO/ubuntu focal/main Translation-en [1892 B]

However, on Jammy, I get the following:

curl "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${FINGERPRINT}" --output /etc/apt/trusted.gpg.d/${FINGERPRINT}.asc

apt-add-repository "deb https://${USERNAME}:${PASSWORD}@private-ppa.launchpad.net/${REPO}/ubuntu jammy main"

Repository: 'deb https://private-ppa.launchpad.net/$REPO/ubuntu jammy main'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 105, in lpppa
    self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 592, in __call__
    response, content = self.root._browser._request(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 429, in _request
    raise error
lazr.restfulclient.errors.NotFound: HTTP Error 404: Not Found
Response headers:
---
-content-encoding: gzip
content-length: 91
content-type: text/plain;charset=utf-8
date: Wed, 16 Mar 2022 19:54:16 GMT
server: gunicorn/19.8.1
status: 404
vary: Accept-Encoding
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: ec4bd7ff-f333-4543-ba91-3b7b063fab0e
x-vcs-revision: 81acd06336f3c4be8f28a2213f7a64912593402d
---
Response body:
---
b"Object: <lp.systemhomes.WebServiceApplication object at 0x7f9652248978>, name: '$REPO'"
---

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/apt-add-repository", line 364, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
  File "/usr/bin/apt-add-repository", line 352, in main
    self.prompt_user_shortcut(shortcut)
  File "/usr/bin/apt-add-repository", line 140, in prompt_user_shortcut
    if shortcut.description:
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 117, in description
    return self.lpppa.description
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 109, in lpppa
    raise ShortcutException(msg)
softwareproperties.shortcuthandler.ShortcutException: ERROR: ppa '$REPO/proposed' not found (use --login if private)

Impish similarly breaks. Digging through changelogs, I see various entries in Impish forward, starting with version 0.99.0 where a refactor was done.

using `--login` is not possible in an automated setup (such as a builder) as it starts an OAuth dance, which requires human interaction. this will break existing automation utilizing apt-add-repository for users when migrating to Jammy

Tags: fr-2116
John Chittum (jchittum)
tags: added: rls-jj-incoming
Changed in software-properties (Ubuntu):
importance: Undecided → High
tags: added: fr-2116
tags: removed: rls-jj-incoming
Changed in software-properties (Ubuntu Jammy):
assignee: nobody → Brian Murray (brian-murray)
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.99.22

---------------
software-properties (0.99.22) jammy; urgency=medium

  * If add-apt-repository is passed a complete soures.list line don't require
    the --login option as that breaks automated setups. Thanks to Dan
    Streetman for the fix. (LP: #1965180)

 -- Brian Murray <email address hidden> Fri, 01 Apr 2022 11:48:01 -0700

Changed in software-properties (Ubuntu Jammy):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers