diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-01-26 16:00:10 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2018-02-12 10:53:49 -0500 |
commit | f576b2a24b8014e91087933d19a7a0d396787c30 (patch) | |
tree | 485f4463a251c7bf1f304f412f57ff4cde72d970 /tests/cloud_tests/collect.py | |
parent | 644048e31a9509390871a6a5ab49b92a5e6c3b87 (diff) | |
download | vyos-cloud-init-f576b2a24b8014e91087933d19a7a0d396787c30.tar.gz vyos-cloud-init-f576b2a24b8014e91087933d19a7a0d396787c30.zip |
tests: add support for logs with lxd from snap and future lxd 3.
This puts in place detection for if 'show-log' will work with lxc
client, and uses that if present. The 'lxc console --show-log' is
not expected to work until lxd/liblxc3.0. That should come in a
few months. The hope is that when that function arrives, this
code will move over to using it.
For other scenarios (all current lxd installs) this will now
support getting logs from a snap installed lxd or a package installed
lxd via the old 'lxc.console.logfile'.
If installed from snap, a platform error will be raised until
the user does:
sudo mkdir --mode=1777 -p /var/snap/lxd/common/consoles
LP: #1745663
Diffstat (limited to 'tests/cloud_tests/collect.py')
-rw-r--r-- | tests/cloud_tests/collect.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/cloud_tests/collect.py b/tests/cloud_tests/collect.py index 5ea88e50..d4f9135b 100644 --- a/tests/cloud_tests/collect.py +++ b/tests/cloud_tests/collect.py @@ -44,8 +44,9 @@ def collect_console(instance, base_dir): LOG.debug('getting console log for %s to %s', instance, logfile) try: data = instance.console_log() - except NotImplementedError: - data = b'instance.console_log: not implemented' + except NotImplementedError as e: + # args[0] is hacky, but thats all I see to get at the message. + data = b'NotImplementedError:' + e.args[0].encode() with open(logfile, "wb") as fp: fp.write(data) |