summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-09-26 21:29:27 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-09-26 21:29:27 +0000
commitfacb92c5b55f4d27ee971eaf49c580fbf92ac2c3 (patch)
tree0dbb6503066167ec4b50b2c58b687c8bde8aec88 /cloudinit/config
parentfd873fa83fb5ca9c6d5f22a7bec6a308448c77ff (diff)
downloadvyos-cloud-init-facb92c5b55f4d27ee971eaf49c580fbf92ac2c3.tar.gz
vyos-cloud-init-facb92c5b55f4d27ee971eaf49c580fbf92ac2c3.zip
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 overly pedantic. Add a 'lxd waitready' (present since lxd 0.5) to wait until lxd is ready before operating on it.
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_lxd.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py
index a604825a..24a8ebea 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', '--timeout=300'])
cmd = ['lxd', 'init', '--auto']
for k in init_keys:
if init_cfg.get(k):
@@ -260,7 +261,9 @@ def bridge_to_cmd(bridge_cfg):
def _lxc(cmd):
- env = {'LC_ALL': 'C'}
+ env = {'LC_ALL': 'C',
+ 'HOME': os.environ.get('HOME', '/root'),
+ 'USER': os.environ.get('USER', 'root')}
util.subp(['lxc'] + list(cmd) + ["--force-local"], update_env=env)