Discussion:
[lxc-users] Python (pylxd) execute isn't working
Matt Green
2016-11-05 00:46:32 UTC
Permalink
I'm trying to push commands to containers and it just isn't working.

I've tried running it in the python command line to see if I can figure out
from pylxd import client
lxdClient = client.Client()
inContainerName = "snmp2"
container = lxdClient.containers.get(inContainerName)
containerExec = ['mkdir /go']
container.execute(containerExec)
(u'', u'')

The corresponding lxc command line works:
lxc exec snmp2 -- mkdir /go

In my /var/log/lxd/lxd.log file I have:
t=2016-11-05T00:29:56+0000 lvl=info msg="Executing command"
environment="[PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]"
args="[/usr/bin/lxd forkexec snmp2 /var/lib/lxd/containers
/var/log/lxd/snmp2/lxc.conf -- env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -- cmd
mkdir /go]"
t=2016-11-05T00:29:56+0000 lvl=info msg="Executed command"
environment="[PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]"
args="[/usr/bin/lxd forkexec snmp2 /var/lib/lxd/containers
/var/log/lxd/snmp2/lxc.conf -- env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -- cmd
mkdir /go]" exit_status=255

It's on an Ubuntu 16.04LTS server running pylxd (2.1.2)

Any ideas what's wrong or how to debug further?

Cheers,

Matt

Loading...