← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:fix/lxd-may-come-in-snap into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:fix/lxd-may-come-in-snap into cloud-init:master.

Commit message:
lxd: adjust to snap installed lxd.

Relax expectation on path to lxc and lxd.  The deb path still does
install them in /usr/bin/ but that is overlay pedantic.

Add a 'lxd waitready' (present since lxd 0.5) to wait until lxd
is ready before operating on it.


Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/355730

see commit message
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:fix/lxd-may-come-in-snap into cloud-init:master.
diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py
index a604825..f9f5aab 100644
--- a/cloudinit/config/cc_lxd.py
+++ b/cloudinit/config/cc_lxd.py
@@ -104,6 +104,7 @@ def handle(name, cfg, cloud, log, args):
             'network_address', 'network_port', 'storage_backend',
             'storage_create_device', 'storage_create_loop',
             'storage_pool', 'trust_password')
+        util.subp(['lxd', 'waitready'])
         cmd = ['lxd', 'init', '--auto']
         for k in init_keys:
             if init_cfg.get(k):
diff --git a/tests/cloud_tests/testcases/modules/lxd_bridge.py b/tests/cloud_tests/testcases/modules/lxd_bridge.py
index c0262ba..f6011de 100644
--- a/tests/cloud_tests/testcases/modules/lxd_bridge.py
+++ b/tests/cloud_tests/testcases/modules/lxd_bridge.py
@@ -10,12 +10,12 @@ class TestLxdBridge(base.CloudTestCase):
     def test_lxd(self):
         """Test lxd installed."""
         out = self.get_data_file('lxd')
-        self.assertIn('/usr/bin/lxd', out)
+        self.assertIn('/lxd', out)
 
     def test_lxc(self):
         """Test lxc installed."""
         out = self.get_data_file('lxc')
-        self.assertIn('/usr/bin/lxc', out)
+        self.assertIn('/lxc', out)
 
     def test_bridge(self):
         """Test bridge config."""
diff --git a/tests/cloud_tests/testcases/modules/lxd_dir.py b/tests/cloud_tests/testcases/modules/lxd_dir.py
index 1495674..26a3db3 100644
--- a/tests/cloud_tests/testcases/modules/lxd_dir.py
+++ b/tests/cloud_tests/testcases/modules/lxd_dir.py
@@ -10,11 +10,11 @@ class TestLxdDir(base.CloudTestCase):
     def test_lxd(self):
         """Test lxd installed."""
         out = self.get_data_file('lxd')
-        self.assertIn('/usr/bin/lxd', out)
+        self.assertIn('/lxd', out)
 
     def test_lxc(self):
         """Test lxc installed."""
         out = self.get_data_file('lxc')
-        self.assertIn('/usr/bin/lxc', out)
+        self.assertIn('/lxc', out)
 
 # vi: ts=4 expandtab

Follow ups