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

Container.push_path() only supports text files #1455

Closed
lucabello opened this issue Nov 15, 2024 · 0 comments · Fixed by #1458
Closed

Container.push_path() only supports text files #1455

lucabello opened this issue Nov 15, 2024 · 0 comments · Fixed by #1458
Assignees
Labels
feature New feature or request small item

Comments

@lucabello
Copy link

As you can see in the linked code below, the Container.push_path() function only works with text files. Internally, it's calling Container.push(), but it doesn't allow customizing its parameters, so you can't specify encoding, permissions, user_id and so on.

operator/ops/model.py

Lines 2594 to 2598 in 77b85ee

def push_path(
self,
source_path: Union[str, Path, Iterable[Union[str, Path]]],
dest_dir: Union[str, PurePath],
):

It would be great if at least the encoding parameter was surfaced in push_path, so that it's possible to get binary files from the charm container.

My current workaround:

with open(binary_file, "rb") as f:
	container.push(dst_path, source=f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request small item
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants