summaryrefslogtreecommitdiff
path: root/cloudinit/config
AgeCommit message (Collapse)Author
2021-08-16User-Data: T3735: Fixed "multi" nodes type searchzsdc
Several nodes with "multi" type contain extra space character after the `multi:` mark, which prevents the `cc_vyos_userdata` module to detect their type properly. This commit changes the regex used for detecting such nodes to fix the problem.
2021-06-27T3653: Cloudinit subnet error if a cidr (/24) is used instead of a subnet ↵Kim Hagen
mask (255.255.255.0)
2021-04-03Azure: T3432: Changed workaround for SSH keys on Azurezsdc
Appending all the data from `metadata_ds['public-keys']` to a list of public keys is dangerous because some of the other datasources have the same `public-keys` option but use different formats inside. Thus, the workaround was limited to Azure datasource only.
2021-03-29domain-name: T3446: Cloudinit error message when empty domain is passed to ↵Kim Hagen
filter.
2021-03-29Metadata: T3432: Azure ssh keys not working for version 1.2.7/1.3.x updateKim Hagen
2021-03-25Metadata: T3432: Azure ssh keys not working for version 1.2.7/1.3.xKim Hagen
2021-01-29T3270: Backported all changes from the equuleus branchzsdc
The behavior of VyOS modules was almost totally changed. Therefore instead of changes, here is a list of what is supported by new versions: `cc_vyos.py`: - extended logging for debugging purposes - work with any environment or datasource - all available in VyOS SSH keys (ssh-dss, ssh-rsa, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ssh-ed25519, ecdsa-sha2-nistp521) with options - both encrypted and plain-text passwords - multiple user accounts - the fallback user creating (default "vyos/vyos") in credentials are missed in a Meta-Data - interfaces configuration using Network-Config v1 or v2 - fallback interface config (DHCP on eth0) if Network-config is not available - both IPv4 and IPv6 addresses in Network-Config - MTU, multiple addresses, DHCP or static addresses, gateway, routes, DNS nameserver, DNS search domain in Network-Config - filtration of a hostname value from metadata - VyOS-specific options from the OVF template - automatically enabling SSH server `cc_vyos_userdata.py`: set and delete configuration commands inside the User-Data (#cloud-config). See details: https://github.com/vyos/vyos-cloud-init/commit/1607eec32641ad93ea211e447336b3366c28de06 Configuration template: - enabled `write_files` module - disabled the `runcmd` module (functionality replaced by `cc_vyos_userdata.py` and `write_files`)
2020-09-10use user config rather than global config to configure pass and ssh loginMaple Wang
Signed-off-by: Daniil Baturin <daniil@vyos.io>
2020-01-02T1934: Change default hostname when deploy from OVA without params.Kim Hagen
2019-12-03option to enable http api optionsKim Hagen
2019-11-12add the ability to put the api keyKim Hagen
2019-10-07do not set dhcp after vmware configKim Hagen
2019-09-24set correct referenceKim Hagen
2019-08-16update vyos config module to include network configUnicronNL
2019-03-12do not change hostname if it is emptyKim Hagen
2019-03-12account for empty ssk keys and passwordsKim Hagen
2019-02-28use ovf labels to set vyos configKim Hagen
2019-01-23Merge tag '18.5' into currentKim Hagen
release 18.5 Bump the version on cloudinit/version.py to be 18.5 and update ChangeLog LP: #1808380 Conflicts: config/cloud.cfg.tmpl
2018-12-06write_files: add support for appending to files.James Baxter
Add 'append: true' to write_files entries to append 'content' to file specified by 'path' key. This modifies the file open mode to append.
2018-11-14resizefs: Prefix discovered devpath with '/dev/' when path does not existIgor Galić
In some environments, like FreeBSD, gpart can return the device basename instead of the full path. If this discovered devpath does not exist and is missing the '/dev/' prefix, add that prefix in an attempt to find the device.
2018-10-25Merge tag 'ubuntu/18.4-0ubuntu1_16.04.2' into currentKim Hagen
Conflicts: cloudinit/sources/DataSourceAzure.py config/cloud.cfg.tmpl integration-requirements.txt tools/read-version
2018-10-23Use dhcp for google cloud sourceKim Hagen
Rework check to see which part of ssh key is which
2018-10-22set user tagKim
2018-10-21add vyos cloud-init config moduleKim Hagen
2018-10-11Correct spelling in an error message (udevadm).Katie McLaughlin
Fix a typo in a RuntimeError path. (udevamd -> udevadm).
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-09-08config: disable ssh access to a configured user accountChad Smith
Cloud config can now disable ssh access to non-root users. When defining the 'users' list in cloud-configuration a boolean 'ssh_redirect_user: true' can be provided to disable ssh logins for that user. Any ssh 'public-keys' defined in cloud meta-data will be added and disabled in .ssh/authorized_keys. Any attempts to ssh as this user using acceptable ssh keys will be presented with a message like the following: Please login as the user "ubuntu" rather than the user "youruser".
2018-09-05tests: Disallow use of util.subp except for where needed.Scott Moser
In many cases, cloud-init uses 'util.subp' to run a subprocess. This is not really desirable in our unit tests as it makes the tests dependent upon existance of those utilities. The change here is to modify the base test case class (CiTestCase) to raise exception any time subp is called. Then, fix all callers. For cases where subp is necessary or actually desired, we can use it via   a.) context hander CiTestCase.allow_subp(value)   b.) class level self.allowed_subp = value Both cases the value is a list of acceptable executable names that will be called (essentially argv[0]). Some cleanups in AltCloud were done as the code was being updated.
2018-09-01Add unit tests for config/cc_ssh.pyFrancis Ginther
These tests focus on the apply_credentials method and the ssh setup for root and a distro default user.
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-07-09docs: note in rtd about avoiding /tmp when writing filesChad Smith
LP: #1727876
2018-06-28docs: Fix a small spelling error.Oz N Tiram
standargs -> standards.
2018-06-19docs: represent sudo:false in docs for user_groups config moduleChad Smith
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
2018-05-29pyflakes: fix unused variable references identified by pyflakes 2.0.0.Scott Moser
A newer version of pyflakes (2.0.0) was released. It identifed some unused variables that version 1.6.0 did not identify. The change here merely fixes those unused variables.
2018-05-23yaml_load/schema: Add invalid line and column nums to error messageChad Smith
Yaml tracebacks are generally hard to read for average users. Add a bit of logic to util.yaml_load and schema validation to look for YAMLError.context_marker or problem_marker line and column counts. No longer log the full exceeption traceback from the yaml_load error, instead just LOG.warning for the specific error and point to the offending line and column where the problem exists.
2018-05-22cc_mounts: Do not add devices to fstab that are already present.Lars Kellogg-Stedman
Do not add new entries to /etc/fstab for devices that already have an existing fstab entry. Resolves: rhbz#1542578
2018-05-17read_file_or_url: move to url_helper, fix bug in its FileResponse.Scott Moser
The result of a read_file_or_url on a file and on a url would differ in behavior. str(UrlResponse) would return UrlResponse.contents.decode('utf-8') while str(FileResponse) would return str(FileResponse.contents) The difference being "b'foo'" versus "foo". As part of the general goal of cleaning util, move read_file_or_url into url_helper.
2018-05-16flake8: fix flake8 errors in previous commit.Scott Moser
2018-05-16typos: Fix spelling mistakes in cc_mounts.py log messagesStephen Ford
This also makes some of the messages more consistent.
2018-05-01FreeBSD: Invoke growfs on ufs filesystems such that it does not prompt.Harm Weites
By default, FreeBSD's growfs runs interactively asking a question which can be mitigated using the '-y' command line option. The fix here is simply to pass -y to growfs to avoid the prompt. LP: #1404745
2018-04-26net: detect unstable network names and trigger a settle if neededRyan Harper
The cloud-init-local.service expects that any network device name changes have already been completed by the kernel or udev daemon. In some situations we've found that the renaming of interfaces from kernel names (eth0, eth1, etc) to their persistent names (eno1, ens3, enp0s1, etc) may happen after cloud-init-local has started where it reads values from sysfs about what network devices are present, and which device to use as a fallback nic. Subsequently, cloud-init-local would write out network configuration for a kernel device name which would no longer be present by the time that networking services start to bring up the devices. The result is that the instance does not get networking configured. Prior to use of systemd-networkd, the Ubuntu 'networking.service' unit included a call to udevadm settle which is why this race is not seen on a Xenial system. This change adds the ability to detect if an interface has a stable name, if if we find one without stable names and stable names have not been disabled (net.ifnames=0 in /proc/cmdline), then cloud-init will invoke udevadm settle. LP: #1766287
2018-04-20schema: in validation, raise ImportError if strict but no jsonschema.Scott Moser
validate_cloudconfig_schema with strict=True would not actually validate if there was no jsonschema available. That seems kind of strange. The change here is to make it raise an exception if strict was passed in. And then to fix the one test that needed a skipIfJsonSchema wrapper.
2018-04-20set_passwords: Add newline to end of sshd config, only restart if updated.Scott Moser
This admittedly does a fairly extensive re-factor to simply add a newline to the end of sshd_config. It makes the ssh_config updating portion of set_passwords more testable and adds tests for that. The new function is in 'update_ssh_config_lines' which allows you to update a config with multiple changes even though only a single one is currently used. We also only restart the ssh daemon now if a change was made to the config file. Before it was always restarted if the user specified a value for ssh_pwauth other than 'unchanged'. Thanks to Lorens Kockum for initial diagnosis and patch. LP: #1677205
2018-04-19pylint: pay attention to unused variable warnings.Scott Moser
This enables warnings produced by pylint for unused variables (W0612), and fixes the existing errors.
2018-04-18Schema: do not warn on duplicate items in commands.Scott Moser
runcmd, bootcmd, snap/commands, ubuntu-advantage/commands would log warning (and fail if strict) on duplicate values in the commands. But those should be allowed. Example, it is perfectly valid to do: runcmd: ['sleep 1', 'sleep 1'] LP: #1764264
2018-04-18net: Depend on iproute2's ip instead of net-tools ifconfig or routeChad Smith
The net-tools package is deprecated and will eventually be dropped. Use "ip route", "link" or "address" instead of "ifconfig" or "route" calls. Cloud-init can now run in an environment that no longer has net-tools. This affects the network and route printing emitted to cloud-config-output.log as well as the cc_disable_ec2_metadata module. Additional changes:  - separate readResource and resourceLocation into standalone test    functions  - Fix ipv4 address rows to report scopes represented by ip addr show  - Formatted route/address ouput now handles multiple ipv4 and ipv6    addresses on a single interface Co-authored-by: James Hogarth <james.hogarth@gmail.com> Co-authored-by: Robert Schweikert <rjschwei@suse.com>
2018-04-18pycodestyle: Fix invalid escape sequences in string literals.Scott Moser
Python has deprecated these invalid string literals now https://bugs.python.org/issue27364 and pycodestyle is identifying them with a W605 warning. https://github.com/PyCQA/pycodestyle/pull/676 So basically, any use of \ not followed by one of [\'"abfnrtv] or \ooo (octal) \xhh (hex) or a newline is invalid. This is most comomnly seen for us in regex. To solve, you either: a.) use a raw string r'...' b.) correctly escape the \ that was not intended to be interpreted.
2018-04-12Implement ntp client spec with auto support for distro selectionRyan Harper
Add a base NTP client configuration dictionary and allow Distro specific changes to be merged. Add a select client function which implements logic to preferr installed clients over clients which need to be installed. Also allow distributions to override the cloud-init defaults. LP: #1749722
2018-04-03correct documentation to match correct attribute name usage.Dominic Schlegel
LP: #1420018