Here is a version of your first script which does work. There is no
indication at host level of when the container has managed to get an ip
address, so best would be to replace my time.sleep(5) with a loop which
repeats until the reported ip is not empty.
Near as I can tell there is no bug here, so marking this invalid.
Please feel free to ask in #lxcontainers or in the lxc-users mailing
list if you have more questions.
#!/usr/bin/python
import commands
from fabric.api import settings
from fabric.operations import run
import sys
import time
def main():
commands.getstatusoutput("lxc-stop -n test")
commands.getstatusoutput("lxc-destroy -n test")
result = commands.getstatusoutput("lxc-create -t ubuntu -n test")
if result[0] != 0:
sys.exit(1)
result = commands.getstatusoutput("lxc-start -d -n test")
if result[0] != 0:
sys.exit(1)
commands.getstatusoutput("lxc-wait -n test -s RUNNING")
time.sleep(5)
result = commands.getstatusoutput("lxc-info -n test -i -H")
ip = result[1]
print ip
with settings(host_string=ip,user="ubuntu",password="ubuntu"):
print run("whoami",shell=True)
if __name__ == "__main__":
main()
** Changed in: lxc (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1264338
Title:
could not route the host for container
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1264338/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs