Bug 1775437 - python3 podman api p- ull image function throws KeyError for id
Summary: python3 podman api p- ull image function throws KeyError for id
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-podman-api
Version: 31
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Athos Ribeiro
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-22 00:18 UTC by Ryan Mullett
Modified: 2020-06-24 21:36 UTC (History)
1 user (show)

Fixed In Version: python-podman-api-0.0.0-0.7.20200614gitd4b8263.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-06-23 01:20:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ryan Mullett 2019-11-22 00:18:18 UTC
Description of problem:
Pull image function throws KeyError for id. This is resolved upstream, but the release in F31 still has the issue.

Version-Release number of selected component (if applicable):
python3-podman-api-0.0.0-0.2.20190613gitd0a45fe.fc31.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install python3-podman-api:

# yum install python3-podman
2. Attempt to access pull(self,source) from Python podman:

# python3
Python 3.7.4 (default, Aug 12 2019, 14:45:07) 
[GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import podman
>>> client = podman.Client()
>>> image = client.images.pull('fedora:latest')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/podman/libs/images.py", line 151, in pull
    return results['id']
KeyError: 'id'

Actual results:
# python3
Python 3.7.4 (default, Aug 12 2019, 14:45:07) 
[GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import podman
>>> client = podman.Client()
>>> image = client.images.pull('fedora:latest')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/podman/libs/images.py", line 151, in pull

Expected results:
# python3
Python 3.7.4 (default, Aug 12 2019, 14:45:07) 
[GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import podman
>>> client = podman.Client()
>>> image = client.images.pull('fedora:latest')
>>> 


Additional info:
This is already fixed in the upstream version. Can be worked around by installing via pip, but prefer that we can pull in the fix that already exists for this upstream into the version shipped with Fedora.

Issue:
Pull image function throws KeyError for id · Issue #30 · containers/python-podman
https://github.com/containers/python-podman/issues/30

PR that resolved it:
Pull image function throws KeyError for id by Phadated · Pull Request #31 · containers/python-podman
https://github.com/containers/python-podman/pull/31

Comment 1 Fedora Update System 2020-06-14 15:23:04 UTC
FEDORA-2020-84dcbbc0bb has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-84dcbbc0bb

Comment 2 Athos Ribeiro 2020-06-14 15:23:41 UTC
Pushed to rawhide and opened an update to f32. It would be nice to get it tested for regressions.

https://bodhi.fedoraproject.org/updates/FEDORA-2020-84dcbbc0bb

Comment 3 Fedora Update System 2020-06-15 02:02:41 UTC
python-podman-api-0.0.0-0.7.20200614gitd4b8263.fc32 has been pushed to the Fedora 32 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-84dcbbc0bb

Comment 4 Ryan Mullett 2020-06-15 22:11:21 UTC
I updated from F31 to F32, and then installed python3-podman-api-0.0.0-0.7.20200614gitd4b8263.fc32.noarch from the testing branch. 

After installing that version, I run the same test and get a different issue, telling me that there is a missing connection socket:

Python 3.8.3 (default, May 15 2020, 00:00:00) 
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import podman
>>> client = podman.Client()
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/podman/client.py", line 203, in __init__
    if not System(self._client).ping():
  File "/usr/lib/python3.8/site-packages/podman/libs/system.py", line 38, in ping
    with self._client() as podman:
  File "/usr/lib/python3.8/site-packages/podman/client.py", line 133, in __enter__
    return self.open()
  File "/usr/lib/python3.8/site-packages/podman/client.py", line 108, in open
    self._iface = self._client.open(self._context.interface)
  File "/usr/lib/python3.8/site-packages/varlink/client.py", line 547, in open
    connection = self.open_connection()
  File "/usr/lib/python3.8/site-packages/varlink/client.py", line 562, in open_connection
    return self._socket_fn()
  File "/usr/lib/python3.8/site-packages/varlink/client.py", line 461, in open_unix
    s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/podman/client.py", line 209, in __init__
    raise ConnectionError(
ConnectionError: [Errno 111] Failed varlink connection "unix:/run/podman/io.podman-io.podman". Is podman socket or service running?
>>> exit()

Confirmed podman is running:

# systemctl status podman
● podman.service - Podman API Service
     Loaded: loaded (/usr/lib/systemd/system/podman.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Mon 2020-06-15 14:20:20 PDT; 33min ago
TriggeredBy: ● podman.socket
       Docs: man:podman-api(1)
   Main PID: 5542 (code=exited, status=0/SUCCESS)
        CPU: 295ms

Jun 15 14:20:10 localhost systemd[1]: Starting Podman API Service...
Jun 15 14:20:10 localhost podman[5542]: This function is EXPERIMENTAL.
Jun 15 14:20:20 localhost systemd[1]: podman.service: Succeeded.
Jun 15 14:20:20 localhost systemd[1]: Finished Podman API Service.

Looking under /run/podman to see if there is anything there:

# ls -l /run/podman
total 0
srw-rw----. 1 root root 0 Jun 15 14:20 podman.sock

So there's /run/podman/podman.sock, but no /run/podman/io.podman-io.podman. Not sure what's supposed to be there. I did confirm that normal podman commands run without issue on my system, it's only when attempting to reproduce this issue that I see the errors.

Comment 5 Fedora Update System 2020-06-23 01:20:40 UTC
FEDORA-2020-84dcbbc0bb has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Athos Ribeiro 2020-06-24 21:33:15 UTC
Hi Ryan,

You need to enable the io.podman.socket as well (systemctl start io.podman.socket)

Here a (sort of) related upstream issue: https://github.com/containers/python-podman/issues/16

Comment 7 Ryan Mullett 2020-06-24 21:36:59 UTC
(In reply to Athos Ribeiro from comment #6)
> Hi Ryan,
> 
> You need to enable the io.podman.socket as well (systemctl start
> io.podman.socket)
> 
> Here a (sort of) related upstream issue:
> https://github.com/containers/python-podman/issues/16

Thanks for the followup, that worked great. I confirmed as well that there was no more KeyError as was present in the initial description.


Note You need to log in before you can comment on or make changes to this bug.