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

wwctl container exec command does not pass arguments #253

Closed
mslacken opened this issue Jan 24, 2022 · 5 comments · Fixed by #1518
Closed

wwctl container exec command does not pass arguments #253

mslacken opened this issue Jan 24, 2022 · 5 comments · Fixed by #1518
Assignees
Milestone

Comments

@mslacken
Copy link
Member

It is not possible to pass any commandline argument which is prefixed with a -, so for the command

wwctl container exec $CONTAINER /bin/FOO --BAAR

the commandline argument --BAAR won't be passed to FOO. This is a known issue with cobra, see spf13/cobra#739

As workaround, one may want to chroot to /var/lib/warewulf/chroots/$CONTAINER/rootfs

@mslacken mslacken added bug wontdo This will not be worked on labels Jan 24, 2022
@jcsiadal
Copy link
Contributor

If a command like "wwctl container path $CONTAINER" could print the canonical path to chroot directory it would be helpful for scripting. Or maybe a more generic "wwctl container info" command, with output options.

@mslacken
Copy link
Member Author

Another workaround is to use double hyphen two times, so e.g. the following comand works

wwctl container exex $CONTAINER /usr/bin/ls -- -- -l -h

@anderbubble
Copy link
Collaborator

anderbubble commented Dec 18, 2022

@mslacken I'd like to look further into this; but, since you made the workaround suggestion, can you explain why

$ sudo wwctl container exec openhpc-slurm-opa-compute-2 -- -- /bin/ls --help

works, but

$ sudo wwctl container exec openhpc-slurm-opa-compute-2 -- /bin/ls --help

does not? I'd think that, if the second example worked, then that'd be basically what other such tools do, and this could be closed.

@mslacken
Copy link
Member Author

@anderbubble The reason for the -- -- is that wwctl exec itself calls wwctl exec __child . So you have to use the dashes two times, as the cobra is also called two times
See https://github.com/hpcng/warewulf/blob/7b15fd4dabb87d31470b01dce87a5542236e484e/internal/app/wwctl/container/exec/main.go#L22

@anderbubble anderbubble removed the wontdo This will not be worked on label Sep 12, 2023
@anderbubble anderbubble added this to the 4.6.0 milestone Sep 13, 2023
@mslacken
Copy link
Member Author

Still this isn't bug, but a known issue

@anderbubble anderbubble added the discuss A topic for discussion in a community meeting label Sep 29, 2023
@anderbubble anderbubble self-assigned this Sep 12, 2024
@anderbubble anderbubble removed the discuss A topic for discussion in a community meeting label Nov 2, 2024
@anderbubble anderbubble removed the bug label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants