-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rename working_dir
to workdir
for consistency
#332
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import re | ||
from contextlib import suppress | ||
from typing import Any, Dict, List, MutableMapping, Union | ||
import warnings | ||
|
||
from podman import api | ||
from podman.domain.containers import Container | ||
|
@@ -287,7 +288,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): Path to the working directory. | ||
|
||
Returns: | ||
A Container object. | ||
|
@@ -403,6 +404,9 @@ def to_bytes(size: Union[int, str, None]) -> Union[int, None]: | |
f"or int (found : {size_type})" | ||
) | ||
|
||
if "working_dir" in args: | ||
warnings.warn("working_dir is deprecated, use workdir instead", PendingDeprecationWarning) | ||
|
||
Comment on lines
+407
to
+409
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the warning. The library is intended to be a super set of the Docker SDK which uses |
||
# Transform keywords into parameters | ||
params = { | ||
"annotations": pop("annotations"), # TODO document, podman only | ||
|
@@ -484,7 +488,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", []): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,6 +322,12 @@ def test_read_write_tmpfs(self): | |
print(inspect) | ||
self.assertIn(expected_output, logs) | ||
|
||
def test_container_working_dir_deprecation(self): | ||
with self.assertWarns(PendingDeprecationWarning): | ||
self.client.containers.create( | ||
self.alpine_image, working_dir="/tmp", command=["/bin/ls", "-l", "/"] | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for including a test, but it will need to be adjusted to verify |
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please retain this comment, see below.