add-apt-repository explodes on missing ppa

Bug #1594776 reported by Mark Shuttleworth
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Fix Released
Medium
Brian Murray

Bug Description

Just saw this on freshly updated Xenial. I think it's trying to be helpful and tell me what PPAs a particular LP team has published, but in the end it explodes:

$ sudo add-apt-repository ppa:juju/next
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 102, in _get_https_content_py3
    lp_page = urllib.request.urlopen(request, cafile=LAUNCHPAD_PPA_CERT)
  File "/usr/lib/python3.5/urllib/request.py", line 162, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 471, in open
    response = meth(req, response)
  File "/usr/lib/python3.5/urllib/request.py", line 581, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.5/urllib/request.py", line 509, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 443, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 589, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 327, in get_ppa_info
    ret = get_ppa_info_from_lp(user, ppa)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 92, in get_ppa_info_from_lp
    return get_info_from_lp(lp_url)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 88, in get_info_from_lp
    return _get_https_content_py3(lp_url)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 108, in _get_https_content_py3
    raise PPAException("Error reading %s: %s" % (lp_url, reason), e)
softwareproperties.ppa.PPAException: 'Error reading https://launchpad.net/api/1.0/~juju/+archive/ubuntu/next: Not Found'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 393, in shortcut_handler
    return PPAShortcutHandler(shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 356, in __init__
    info = get_ppa_info(self.shortcut)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 339, in get_ppa_info
    _get_suggested_ppa_message(user, ppa))
softwareproperties.shortcuts.ShortcutException: Cannot add PPA: 'ppa:~juju/ubuntu/next'.
The team named '~juju' has no PPA named 'ubuntu/next'
Please choose from the following available PPAs:
 * '1.22': 1.22 Updates
 * '1.22-proposed': 1.22 Proposed
 * '1.23': 1.23 Updates
 * 'daily': Juju Daily
 * 'devel': juju devel packages
 * 'enablement': Juju Enablement
 * 'experimental': juju experimental packages
 * 'golang': juju-golang
 * 'proposed': juju proposed packages
 * 'stable': juju stable packages
Error: 'ppa:juju/next' invalid

Revision history for this message
Michael Vogt (mvo) wrote :
Revision history for this message
Michael Vogt (mvo) wrote :

With this patch the desired behavior is restored:
"""
$ fakeroot ./add-apt-repository ppa:juju/next
Cannot add PPA: 'ppa:~juju/ubuntu/next'.
The team named '~juju' has no PPA named 'ubuntu/next'
Please choose from the following available PPAs:
 * '1.22': 1.22 Updates
 * '1.22-proposed': 1.22 Proposed
 * '1.23': 1.23 Updates
 * 'daily': Juju Daily
 * 'devel': juju devel packages
 * 'enablement': Juju Enablement
 * 'experimental': juju experimental packages
 * 'golang': juju-golang
 * 'proposed': juju proposed packages
 * 'stable': juju stable packages
"""

Revision history for this message
Michael Vogt (mvo) wrote :
tags: added: patch
Changed in software-properties (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in software-properties (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

---------------
software-properties (0.96.24.1) yakkety; urgency=medium

   * tests/test_shortcuts.py: make the tests python2 compatible.

 -- Brian Murray <email address hidden> Wed, 13 Jul 2016 12:26:53 -0700

Changed in software-properties (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded this to Xenial for review by the SRU team.

Changed in software-properties (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Mark, or anyone else affected,

Accepted software-properties into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/software-properties/0.96.20.3 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 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

Changed in software-properties (Ubuntu Xenial):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

I did not receive a Traceback with the version of the package from -proposed:

[ 11:58AM 10015 ] [ bdmurray@impulse:~ ]
 $ sudo add-apt-repository ppa:juju/next
Cannot add PPA: 'ppa:~juju/ubuntu/next'.
The team named '~juju' has no PPA named 'ubuntu/next'
Please choose from the following available PPAs:
 * '1.22': 1.22 Updates
 * '1.22-proposed': 1.22 Proposed
 * '1.23': 1.23 Updates
 * 'daily': Juju Daily
 * 'devel': juju devel packages
 * 'enablement': Juju Enablement
 * 'experimental': juju experimental packages
 * 'golang': juju-golang
 * 'proposed': juju proposed packages
 * 'stable': juju stable packages
[ 11:59AM 10016 ] [ bdmurray@impulse:~ ]
 $ apt-cache policy software-properties-common
software-properties-common:
  Installed: 0.96.20.3
  Candidate: 0.96.20.3
  Version table:
 *** 0.96.20.3 100
        100 /var/lib/dpkg/status
     0.96.20.2 500
        500 http://192.168.10.7/ubuntu xenial-updates/main amd64 Packages
        500 http://192.168.10.7/ubuntu xenial-updates/main i386 Packages
     0.96.20 500
        500 http://192.168.10.7/ubuntu xenial/main amd64 Packages
        500 http://192.168.10.7/ubuntu xenial/main i386 Packages

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

---------------
software-properties (0.96.20.3) xenial; urgency=medium

  * softwareproperties/ppa.py:
    - fix exception output when `add-apt-repository` is called with
      an invalid ppa (LP: #1594776)
  * tests/test_shortcuts.py:
    - add network check for tests that require talking to launchpad
      or the cloud archives

 -- Brian Murray <email address hidden> Fri, 22 Jul 2016 15:27:26 -0700

Changed in software-properties (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for software-properties 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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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