Could you elaborate what individual items to inspect?

The built-in ansible modules use `apt`, which is how I came across this
issue.

On Wed, Dec 27, 2023, 3:25 AM Julian Andres Klode <
2047...@bugs.launchpad.net> wrote:

> You'll have to investigate the individual items to see why it failed.
> It's generally not advisable to use the "apt" module as it is badly
> abstracted, use "apt_pkg" instead.
>
> ** Changed in: python-apt (Ubuntu)
>        Status: New => Invalid
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2047453
>
> Title:
>   Error message missing compared to `apt-get update`
>
> Status in python-apt package in Ubuntu:
>   Invalid
>
> Bug description:
>   Assuming there is no package server running on `localhost`:
>
>   ```
>   $ echo 'deb [trusted=yes] http://localhost:8000/ bogus-test-repo main'
> | sudo tee /etc/apt/sources.list.d/placeholder-test-repo.list
>   ```
>
>   and then
>
>   ```
>   $ python -c "import apt; c = apt.Cache(); c.update()"
>   Traceback (most recent call last):
>     File "<string>", line 1, in <module>
>     File "/usr/lib/python3/dist-packages/apt/cache.py", line 575, in update
>       raise FetchFailedException()
>   apt.cache.FetchFailedException
>   ```
>
>   and compare with
>
>   ```
>   $ sudo apt-get update
>   Ign:1 http://localhost:8000 bogus-test-repo InRelease
>   Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
>
>   Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
>
>   Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
>
>   Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
>   Ign:1 http://localhost:8000 bogus-test-repo InRelease
>   Ign:1 http://localhost:8000 bogus-test-repo InRelease
>   Err:1 http://localhost:8000 bogus-test-repo InRelease
>     Could not connect to localhost:8000 (127.0.0.1). - connect (111:
> Connection refused)
>   Reading package lists... Done
>   W: Failed to fetch http://localhost:8000/dists/bogus-test-repo/InRelease
> Could not connect to localhost:8000 (127.0.0.1). - connect (111: Connection
> refused)
>   W: Some index files failed to download. They have been ignored, or old
> ones used instead.
>   ```
>
>   I expected the Python `apt` interface to produce a similar or
>   identical error message.
>
>
>   ```
>   # lsb_release -rd
>   Description:    Ubuntu 22.04.3 LTS
>   Release:        22.04
>
>   # apt-cache policy python3-apt
>   python3-apt:
>     Installed: 2.4.0ubuntu2
>     Candidate: 2.4.0ubuntu2
>     Version table:
>    *** 2.4.0ubuntu2 500
>           500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64
> Packages
>           100 /var/lib/dpkg/status
>        2.3.0ubuntu2 500
>           500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
>   ```
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/2047453/+subscriptions
>
>

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to python-apt in Ubuntu.
https://bugs.launchpad.net/bugs/2047453

Title:
  Error message missing compared to `apt-get update`

Status in python-apt package in Ubuntu:
  Invalid

Bug description:
  Assuming there is no package server running on `localhost`:

  ```
  $ echo 'deb [trusted=yes] http://localhost:8000/ bogus-test-repo main' | sudo 
tee /etc/apt/sources.list.d/placeholder-test-repo.list
  ```

  and then

  ```
  $ python -c "import apt; c = apt.Cache(); c.update()"
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/lib/python3/dist-packages/apt/cache.py", line 575, in update
      raise FetchFailedException()
  apt.cache.FetchFailedException
  ```

  and compare with

  ```
  $ sudo apt-get update
  Ign:1 http://localhost:8000 bogus-test-repo InRelease
  Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease                   
  Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease         
  Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease           
  Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Ign:1 http://localhost:8000 bogus-test-repo InRelease
  Ign:1 http://localhost:8000 bogus-test-repo InRelease
  Err:1 http://localhost:8000 bogus-test-repo InRelease
    Could not connect to localhost:8000 (127.0.0.1). - connect (111: Connection 
refused)
  Reading package lists... Done
  W: Failed to fetch http://localhost:8000/dists/bogus-test-repo/InRelease  
Could not connect to localhost:8000 (127.0.0.1). - connect (111: Connection 
refused)
  W: Some index files failed to download. They have been ignored, or old ones 
used instead.
  ```

  I expected the Python `apt` interface to produce a similar or
  identical error message.


  ```
  # lsb_release -rd
  Description:    Ubuntu 22.04.3 LTS
  Release:        22.04

  # apt-cache policy python3-apt
  python3-apt:
    Installed: 2.4.0ubuntu2
    Candidate: 2.4.0ubuntu2
    Version table:
   *** 2.4.0ubuntu2 500
          500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
          100 /var/lib/dpkg/status
       2.3.0ubuntu2 500
          500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/2047453/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to