Skip to content
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

docs: make pebble.Client.remove_path and Container.remove_path docs consistent #1031

Merged
merged 10 commits into from
Oct 10, 2023
10 changes: 9 additions & 1 deletion ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,15 @@ def remove_path(self, path: Union[str, PurePath], *, recursive: bool = False):

Args:
path: Path of the file or directory to delete from the remote system.
recursive: If True, recursively delete path and everything under it.
recursive: If True, and path is a directory, recursively delete it and
everything under it. If path is a file, delete the file. In
either case, do nothing if the file or directory does not
exist. Behaviourally similar to ``rm -rf <file|dir>``.

Raises:
pebble.PathError: If a relative path is provided, or if `recursive` is False
and the file or directory cannot be removed (it does not exist or is not empty).

"""
self._pebble.remove_path(str(path), recursive=recursive)

Expand Down
6 changes: 5 additions & 1 deletion ops/pebble.py
Original file line number Diff line number Diff line change
Expand Up @@ -2153,11 +2153,15 @@ def remove_path(self, path: str, *, recursive: bool = False):

Args:
path: Path of the file or directory to delete from the remote system.
recursive: If True, and path is a directory recursively deletes it and
recursive: If True, and path is a directory, recursively deletes it and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also please copy the new version above to here? "recursive" and "Raises".

everything under it. If the path is a file, delete the file and
do nothing if the file is non-existent. Behaviourally similar
to ``rm -rf <file|dir>``.

Raises:
PathError: If the file cannot be removed (perhaps it does not
exist) and `recursive` is false, or if a relative path is provided.

"""
info: Dict[str, Any] = {'path': path}
if recursive:
Expand Down
Loading