summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_lxd.py
AgeCommit message (Collapse)Author
2020-08-27LXD: detach network from profile before deleting it (#542)Paride Legovini
* LXD: detach network from profile before deleting it When cleaning up the bridge network created by default by LXD as part of the `lxd init` process detach the network its profile before deleting it. LXD will otherwise refuse to delete it with error: Error: The network is currently in use. Discussion with LXD upstream: https://github.com/lxc/lxd/issues/7804. LP: #1776958 * LXD bridge deletion: fail if bridge exists but can't be deleted * LXD bridge deletion: remove useless failure logging
2020-06-08Move subp into its own module. (#416)Scott Moser
This was painful, but it finishes a TODO from cloudinit/subp.py. It moves the following from util to subp: ProcessExecutionError subp which target_path I moved subp_blob_in_tempfile into cc_chef, which is its only caller. That saved us from having to deal with it using write_file and temp_utils from subp (which does not import any cloudinit things now). It is arguable that 'target_path' could be moved to a 'path_utils' or something, but in order to use it from subp and also from utils, we had to get it out of utils.
2019-10-17replace any deprecated log.warn with log.warningDominic Schlegel
Commit 6797e822959b84c98cf73e02b2a6e3d6ab3fd4fe replaced the LOG.warn calls that linters were warning about; this also replaces calls that linters would not have recognised (as `log` is generally a parameter in these scenarios). LP: #1508442
2019-07-10Fix a couple of issues raised by a coverity scanDaniel Watkins
* cc_lxd: fix copy/paste error in debug logging * DataSourceCloudSigma: remove unreachable code * This unreachable code was introduced in a refactor (in 2015) which removed the need for an exception handler, but retained the logging from the exception handler as an unreachable fall-through.
2019-01-25lxd: install zfs-linux instead of zfs meta packageJohnson Shi
When using the LXD module cloud-init will attempt to install ZFS if it does not exist on the target system. However instead of installing the `zfsutils-linux` package it attempts to install `zfs` resulting in an error. Ubuntu Xenial (16.04) has zfs meta package, but Bionic (18.04) does not. Use the specific base package instead of zfs meta. Co-authored-by: Michael Skalka <michael.skalka@canonical.com> LP: #1799779
2018-09-26lxd: adjust to snap installed lxd.Scott Moser
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.
2018-07-21pylint: Fix pylint warnings reported in pylint 2.0.0.Scott Moser
Pylint 2.0.0 was recently released and complains more about logging-not-lazy than it used to. I've fixed those warnings, here. The changes in rh_subscription are more extensive. pylint may be complaining incorrectly there, but the tests were not correctly un-doing all of their mock/patching. This cleans those up and makes pylint happy.
2018-06-15lxd: Delete default network and detach device if lxd-init created them.Scott Moser
Newer versions (3.0.1+) of lxd create the 'lxdbr0' network when 'lxd init --auto' is invoked. When cloud-init is given a network configuration to pass on to lxc and that config had no name specified or 'lxdbr0', then cloud-init would fail to create the network as it already exists. Similarly, we need to remove the device from the default profile so that the attach code can work. Also, add a _lxc method and use it to make sure we're getting the --force-local flag everywhere. LP: #1776958
2017-10-20citest: fix remaining warnings raised by integration tests.Scott Moser
There was fallout in a full integration test run from my adding of test_no_warnings_in_log which asserted that there could not be a WARNING found in the /var/log/cloud-init.log This fixes 2 of the cases: * TestCommandOutputSimple had a valid WARNING written, so adjust its test case to allow for that. * TestLxdDir had a valid config in the test but the module would log a WARNING, so fix the module. Also updates lxd unit tests to look for WARN themselves.
2016-12-22LICENSE: Allow dual licensing GPL-3 or Apache 2.0Jon Grimm
This has been a recurring ask and we had initially just made the change to the cloud-init 2.0 codebase. As the current thinking is we'll just continue to enhance the current codebase, its desirable to relicense to match what we'd intended as part of the 2.0 plan here. - put a brief description of license in LICENSE file - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0 - simplify the per-file header to reference LICENSE - tox: ignore H102 (Apache License Header check) Add license header to files that ship. Reformat headers, make sure everything has vi: at end of file. Non-shipping files do not need the copyright header, but at the moment tests/ have it.
2016-09-30Improve module documentation and doc cleanup.Wesley Wiedenmeier
This adds lots of config module documentation in a standard format. It will greatly improve the content at readthedocs. Additionally: * Add a 'doc' env to tox.ini * Changed default highlight language for sphinx conf from python to yaml most examples in documentation are yaml configs * Updated datasource examples to highlight sh code properly
2016-09-29lxd: Update network config for LXD 2.3Stéphane Graber
Prior to LXD 2.3, the bridge configuration was done through distro packaging. Thus, lxd module interacted with debconf. With 2.3 and higher, this is now done inside LXD itself, so we need to use "lxc network" there. For now, this perfectly matches what we had before with debconf and doesn't cover any of the new options. We can always add those later. A set of tests similar to what we had for debconf has been added to make sure things look good. This is tested in Yakkety container running LXD 2.3 and all options seem to be passed through as expected, giving me the bridge I defined. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-08-10Add distro tags on config modules that should have itJoshua Harlow
Some of these really won't work to well on non-supporting distros so to avoid further user pain tag this with the supported distros where they should work.
2016-06-03lxd: fix log messsageScott Moser
2016-05-12Fix up a ton of flake8 issuesJoshua Harlow
2016-04-11minor cleanupsScott Moser
- use util.del_file rather than os.remove - raise exception if debconf-communicate is not present - add a trailing newline into debconf-communicate input
2016-04-11lxd-bridge: Don't require a bridge name and implement support for domain nameStéphane Graber
2016-04-11Update lxd-bridge code to do a single debconf-communicate run and split ↵Stéphane Graber
debconf logic to a function
2016-04-11Add support for lxd-bridge configurationStéphane Graber
2016-03-03fix some of pylints complaintsScott Moser
2016-03-03fix lxd module to not do anything unless config providedScott Moser
2016-03-01lxd: general fix after testingScott Moser
A few changes: a.) change to using '--name=value' rather than '--name' 'value' b.) make sure only strings are passed to command (useful for storage_create_loop: which is likely an integer) c.) document simple working example d.) support installing zfs if not present and storage_backedn has it.
2016-02-25minor cleanupsScott Moser
2016-02-04 - Ensure that lxd is installed before running lxd init.Wesley Wiedenmeier
- Handle init cfg separately from main cfg to allow multiple sections under lxd config to be handled independantly. - Check for properly formatted lxd init cfg
2016-02-03lxd: add support for setting up lxd using 'lxd init'Wesley Wiedenmeier
If lxd key is present in cfg, then run 'lxd init' with values from the 'init' entry in lxd configuration as flags.