Skip to content

Commit

Permalink
Add workdir as alias for working_dir
Browse files Browse the repository at this point in the history
Currently `podman-py` uses all three versions of `work_dir`,
`working_dir` and `workdir` (not to mention `WorkingDir`).

This commit tries to unify the parameter usage by allowing `workdir` for
container `create` or `run`. For backwards compatibility `working_dir`
still works.

Since upstream Podman uses a variety of *workdir* versions the
`podman-py` codebase can't be simplified further.

Fix: #330

Signed-off-by: Paul Spooren <[email protected]>
Signed-off-by: Urvashi Mohnani <[email protected]>
  • Loading branch information
aparcar authored and umohnani8 committed Jan 22, 2024
1 parent a6630ad commit d85c51f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion podman/domain/containers_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def create(
volumes_from (List[str]): List of container names or IDs to get volumes from.
working_dir (str): Path to the working directory.
workdir (str): Alias of working_dir - Path to the working directory.
Returns:
A Container object.
Expand Down Expand Up @@ -525,7 +526,7 @@ def to_bytes(size: Union[int, str, None]) -> Union[int, None]:
"version": pop("version"),
"volumes": [],
"volumes_from": pop("volumes_from"),
"work_dir": pop("working_dir"),
"work_dir": pop("workdir") or pop("working_dir"),
}

for device in args.pop("devices", []):
Expand Down

0 comments on commit d85c51f

Please sign in to comment.