-
Notifications
You must be signed in to change notification settings - Fork 133
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
No way to pass stdin to Container.execute #244
Comments
How would you see that working? Can you give an example of the types of things you are piping into At the moment the execute command on a container (https://github.com/lxc/pylxd/blob/master/pylxd/models/container.py#L207) takes a list as the command (like subprocess.check_call() and friends). It then uses the lxd RESTful API to run the command (async) and uses a websocket to get the results. So, how might what you'd like to achieve fit into that model? |
One example is where we want to add trusted keys to a build. We do this by running the rough equivalent of Whether the command is passed as a list or not is immaterial for this purpose, although of course I agree that that's generally the best way to do things. I'm not particularly familiar with websockets, but ideally I'd like to be able to pass something like |
Okay, I think I understand. I think we could do something where an object could be passed that has a duck-typed As Is this what you were thinking? |
This is pretty important missing feature. Not easily worked around at all and seemingly somewhat basic functionality. @cjwatson how did you work around this? |
Well, just for reference for others, we have worked around this in cloud-init by pushing (files.put) a file to a temporary location in the container, and then using 'sh' to set its stdin to the file, execute the command and then remove the file. platforms/lxd/instance.py:_execute I came across issue #268 yesterday and filed that. Please keep in mind when fixing this that stdin should not be expected to be utf-8 either. |
I recently added LXD backend support to launchpad-buildd. I was able to use pylxd for almost all of it, but we need to be able to pipe standard input into
lxc exec
in some cases, and pylxd'sContainer.execute
can't do that. Could this feature be added?The text was updated successfully, but these errors were encountered: