Conversation
Install quadlet passing them to the install function as as a tuples (name, content) or a file path or a list of both. Fixes: https://issues.redhat.com/browse/RUN-4367 Signed-off-by: Nicola Sella <[email protected]>
| "reload-systemd": reload_systemd, | ||
| } | ||
|
|
||
| first = files[0] |
There was a problem hiding this comment.
What happens if the files are empty?
There was a problem hiding this comment.
the function will fail before with TypeError because file is a named arg
>>> client.quadlets.install()
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
client.quadlets.install()
~~~~~~~~~~~~~~~~~~~~~~~^^
TypeError: QuadletsManager.install() missing 1 required positional argument: 'files'
There was a problem hiding this comment.
What about len(files) == 0 case?
| FileNotFoundError: when a provided file path does not exist on | ||
| disk. | ||
| """ | ||
| if not isinstance(files, builtins.list): |
There was a problem hiding this comment.
if tuple, it will move through this check and it will be processed inside _prepare_install_body, which will check for tuple or pathlike and process the files arg
podman/domain/quadlets.py
Outdated
| @staticmethod | ||
| def _is_tar_path(item: "QuadletFileItem") -> bool: | ||
| """Return True if *item* looks like a path to a ``.tar`` archive.""" | ||
| return isinstance(item, (str, os.PathLike)) and str(item).endswith(".tar") |
There was a problem hiding this comment.
good catch, I'll improve and test
There was a problem hiding this comment.
I fixed it in a separate commit so you can review it with convenience, then I'll squash before merging once you approve
podman/domain/quadlets.py
Outdated
|
|
||
|
|
||
| # Type alias – importable for type annotations in calling code. | ||
| QuadletFileItem = Union[tuple[str, str], str, os.PathLike] |
There was a problem hiding this comment.
| QuadletFileItem = Union[tuple[str, str], str, os.PathLike] | |
| QuadletFileItem = Union[tuple[str, Union[str, bytes]], str, os.PathLike] |
Signed-off-by: Nicola Sella <[email protected]>
| "reload-systemd": reload_systemd, | ||
| } | ||
|
|
||
| first = files[0] |
There was a problem hiding this comment.
What about len(files) == 0 case?
Install quadlet passing them to the install function as as a tuples (name, content) or a file path or a list of both.
Fixes: https://issues.redhat.com/browse/RUN-4367