summaryrefslogtreecommitdiff
path: root/cloudinit/config
AgeCommit message (Collapse)Author
2021-09-01puppet config: add the start_agent option (#1002)Andrew Bogott
The current code starts the puppet agent and also sets autostart in all cases. This conflicts with a common pattern where puppet itself manages the agent and autostart state. For example, in my deploy puppet disables the puppet agent and replaces it with a cron. This causes various races both within this cloud-init unit and within puppet itself while cloud-init and puppet fight over whether or not to enable the service.
2021-08-12cc_resolv_conf: fix typos (#969)Shreenidhi Shedi
Add tests for cc_resolv_conf handler
2021-08-10cc_puppet: support AIO installations and more (#960)Gabriel Nagy
- update the puppet module to support AIO installations by setting `install_type` to `aio` - make the install collection configurable through the `collection` parameter; by default the rolling `puppet` collection will be used, which installs the latest version) - when `install_type` is `aio`, puppetlabs repos will be purged after installation; set `cleanup` to `False` to prevent this - AIO installations are performed by downloading and executing a shell script; the URL for this script can be overridden using the `aio_install_url` parameter - make it possible to run puppet agent after installation/configuration via the `exec` key - by default, puppet agent will run with the `--test` argument; this can be overridden via the `exec_args` key
2021-08-05Add support for EuroLinux 7 && EuroLinux 8 (#957)Aleksander Baranowski
2021-08-03Implementing device_aliases as described in docs (#945)Mal Graty
Implement missing device_aliases feature The device_aliases key has been documented as part of disk_setup for years, however the feature was never implemented. This implements the feature as documented allowing usercfg (rather than dsconfig) to create a mapping of device names. This is not to be confused with disk_aliases, a very similar map but existing solely for use by datasources. LP: #1867532
2021-07-21Add VZLinux support (#951)eb3095
Virtuozzo Linux is a distro based off of CentOS 8, similar to Alma Linux and Rocky Linux.
2021-06-18Add support for VMware PhotonOS (#909)sshedi
Also added a new (currently experimental) systemd-networkd renderer, and includes a small refactor to cc_resolv_conf.py to support the resolved.conf used by systemd-resolved.
2021-06-14add DragonFlyBSD support (#904)Gonéri Le Bouder
- Mostly based on FreeBSD, the main exception is that `find_devs_with_on_freebsd` does not work. - Since we cannot get the CDROM or the partition labels, `find_devs_with_on_dragonflybsd()` has a more naive approach and returns all the block devices.
2021-05-25Add Rocky Linux support to cloud-init (#906)Louis Abel
Rocky Linux is a RHEL-compatible distribution so all changes that have been made should be trivial.
2021-05-18Added support for importing keys via primary/security mirror clauses (#882)Paul Goins
Presently, mirror keys cannot be associated with primary/security mirrors. Unfortunately, this prevents use of Landscape-managed package mirrors as the mirror key for the Landscape-hosted repository cannot be provided. This patch allows the same key-related fields usable on "sources" entries to be used on the "primary" and "security" entries as well. LP: #1925395
2021-05-07cc_disk_setup.py: remove UDEVADM_CMD definition as not used (#886)dermotbradley
UDEVADM_CMD is defined but not actually used in cc_disk_setup.py so remove it. Also modify the comment at top of read_parttbl function to remove the reference to udevadm which implies it is used to scan the partition table.
2021-05-07Add AlmaLinux OS support (#872)Andrew Lukoshko
AlmaLinux OS is RHEL-compatible so all the changes needed are trivial.
2021-05-03Revert "Add support to resize rootfs if using LVM (#721)" (#887)Daniel Watkins
This reverts commit 74fa008bfcd3263eb691cc0b3f7a055b17569f8b. During pre-release testing, we discovered two issues with this commit. Firstly, there's a typo in the udevadm command that causes a TypeError for _all_ growpart executions. Secondly, the LVM resizing does not appear to successfully resize everything up to the LV, though some things do get resized. We certainly want this change, so we'll be happy to review and land it alongside an integration test which confirms that it is working as expected. LP: #1922742
2021-04-26Fix chef module run failure when chef_license is set (#868)Ben Hughes
Move chef_license from TPL_PATH_KEYS to TPL_KEYS as the chef license setting is not a path but must be added to the client config template. Fixes file or folder not found exception raised from ensure_dirs.
2021-04-22Use `partprobe` to re-read partition table if available (#856)Nicolas Bock
The blkdev command is fragile re-reading partition tables if a partition is mounted. This change instead uses the partprobe if it is available. LP: #1920939
2021-04-15add prefer_fqdn_over_hostname config option (#859)hamalq
the above option allows the user to control the behavior of a distro hostname selection if both short hostname and FQDN are supplied. If `prefer_fqdn_over_hostname` is true the FQDN will be selected as hostname; if false the hostname will be selected LP: #1921004
2021-04-14doc: Replace remaining references to user-scripts as a config module (#866)Ryan Harper
git-grep showed a few more locations where we refer to a "user-scripts" config module which is really cc_scripts_user module. Replace these references with slightly different language so as not to confuse future me when looking for "user-scripts" vs. "scripts-user"
2021-03-30Add support to resize rootfs if using LVM (#721)Eduardo Otubo
This patch adds support to resize a single partition of a VM if it's using an LVM underneath. The patch detects if it's LVM if the given block device is a device mapper by its name (e.g. `/dev/dm-1`) and if it has slave devices under it on sysfs. After that syspath is updated to the real block device and growpart will be called to resize it (and automatically its Physical Volume). The Volume Group will be updated automatically and a final call to extend the rootfs to the remaining space available will be made. Using the same growpart configuration, the user can specify only one device to be resized when using LVM and growpart, otherwise cloud-init won't know which one should be resized and will fail. rhbz: #1810878 LP: #1799953 Signed-off-by: Eduardo Otubo <otubo@redhat.com> Signed-off-by: Scott Moser <smoser@brickies.net>
2021-03-19write passwords only to serial console, lock down cloud-init-output.log (#847)Daniel Watkins
Prior to this commit, when a user specified configuration which would generate random passwords for users, cloud-init would cause those passwords to be written to the serial console by emitting them on stderr. In the default configuration, any stdout or stderr emitted by cloud-init is also written to `/var/log/cloud-init-output.log`. This file is world-readable, meaning that those randomly-generated passwords were available to be read by any user with access to the system. This presents an obvious security issue. This commit responds to this issue in two ways: * We address the direct issue by moving from writing the passwords to sys.stderr to writing them directly to /dev/console (via util.multi_log); this means that the passwords will never end up in cloud-init-output.log * To avoid future issues like this, we also modify the logging code so that any files created in a log sink subprocess will only be owner/group readable and, if it exists, will be owned by the adm group. This results in `/var/log/cloud-init-output.log` no longer being world-readable, meaning that if there are other parts of the codebase that are emitting sensitive data intended for the serial console, that data is no longer available to all users of the system. LP: #1918303
2021-02-24cc_keys_to_console.py: Add documentation for recently added config key (#824)dermotbradley
PR #811 added a new config key, emit_keys_to_console, but didn't update the documentation for mention it.
2021-02-23Update cc_set_hostname documentation (#818)Toshi Aoyama
It is distro dependent whether hostname or fqdn is used
2021-02-22cc_keys_to_console: add option to disable key emission (#811)Michael Hudson-Doyle
Specifically: ssh: emit_keys_to_console: false We also port the cc_keys_to_console cloud tests to the new integration testing framework, and add a test for this new option. LP: #1915460
2021-01-20Use proper spelling for Red Hat (#778)Dan Kenigsberg
The company name has two distinct words. Signed-off-by: Dan Kenigsberg <danken@redhat.com>
2021-01-13cc_seed_random: update documentation and fix integration test (#771)Daniel Watkins
The documentation did not mention that the given data may not be the exact string written: the cloud's random data may be added to it. Additionally, the documentation of the command key was incorrect. test_seed_random_data was updated to check that the given data is a prefix of the written data, to match cloud-init's expected (and, now, documented) behaviour. LP: #1911227
2020-12-17cc_ca_certs: add RHEL support (#633)cawamata
This refactors cc_ca_certs to support non-ca-certificates distros, and adds RHEL support.
2020-11-25cc_apt_configure: add riscv64 as a ports arch (#687)Dimitri John Ledkov
2020-11-20Support configuring SSH host certificates. (#660)Jonathan Lung
Existing config writes keys to /etc/ssh after deleting files matching a glob that includes certificate files. Since sshd looks for certificates in the same directory as the keys, a host certificate must be placed in this directory. This update enables the certificate's contents to be specified along with the keys. Co-authored-by: jonathan lung <lungj@heresjono.com> Co-authored-by: jonathan lung <jlung@kepler.space>
2020-11-19cc_resizefs on FreeBSD: Fix _can_skip_ufs_resize (#655)Mina Galić
On FreeBSD, if a UFS has trim: (-t) or MAC multilabel: (-l) flag, resize FS fail, because the _can_skip_ufs_resize check gets tripped up by the missing options. This was reported at FreeBSD Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250496 and as LP: #1901958 Rather than fixing the parser as in the patches proposed there (and attempted in #636) this pull-request rips out all of it, and simplifies the code. We now use `growfs -N` and check if that returns an error. If it returns the correct kind of error, we can skip the resize, because we either are at the correct size, or the filesystem in question is broken or not UFS. If it returns the wrong kind of error, we just re-raise it. LP: #1901958
2020-11-18cli: add --system param to allow validating system user-data on a machine (#575)Chad Smith
Allow root user to validate the userdata provided to the launched machine using `cloud-init devel schema --system`
2020-11-03Make some language improvements in growpart documentation (#649)Shane Frasier
* Fix awkward English in sentence * Add the missing word "the" * Fix misspelling * Add @jsf9k as a contributor Co-authored-by: Rick Harding <rharding@mitechie.com>
2020-11-02remove unnecessary reboot from gpart resize (#646)Mina Galić
a reboot after `gpart resize` hasn't been necessary since ca FreeBSD 9.2 Co-authored-by: Rick Harding <rharding@mitechie.com>
2020-10-30Correct documentation and testcase data for some user-data YAML (#618)dermotbradley
For cc_users_groups the user setting "expiredate" must be quoted in order for the relevant flag and value to be then passed to the useradd command. It its vaiue is not quoted then it is treated as Python type datetime.date and in `cloudinit/distros/__init__.py` the below "is it a string" condition fails and so no "--expiredate" parameter is passed to useradd and therefore it has no effect: ``` if key in useradd_opts and val and isinstance(val, str): useradd_cmd.extend([useradd_opts[key], val]) ``` For cc_users_groups, the user setting "inactive" does not actually disable accounts, the useradd "--inactive" option actually defines the number of days after password expiry that users can still login. So I have changed the docs to show it taking a quoted value of days (which works with the current code) rather than a boolean value. The quotes are necessary, like expiredate above, so that the value is also passed to the useradd command. For cc_power_state_change.py the "delay" setting value needs to have quotes around it as otherwise its leading plus sign will be stripped off.
2020-10-28Add config modules for controlling IBM PowerVM RMC. (#584)Aman306
Reliable Scalable Cluster Technology (RSCT) is a set of software components that together provide a comprehensive clustering environment(RAS features) for IBM PowerVM based virtual machines. RSCT includes the Resource Monitoring and Control (RMC) subsystem. RMC is a generalized framework used for managing, monitoring, and manipulating resources. RMC runs as a daemon process on individual machines and needs creation of unique node id and restarts during VM boot. LP: #1895979 Co-authored-by: Scott Moser <smoser@brickies.net>
2020-10-20cc_mounts: correctly fallback to dd if fallocate fails (#585)Daniel Watkins
`create_swap()` was previously catching and not re-raising the ProcessExecutionError that indicated swap creation failure; this meant that the fallback logic could never be triggered. This commit adds the required re-raise (as well as removing a duplicated log message). LP: #1897099
2020-10-01Fix name of ntp and chrony service on CentOS and RHEL. (#589)Scott Moser
The service installed by the CentOS and RHEL 'ntp' package is ntpd.service not ntp.service Fix that for those two distros. Also fix chrony service from 'chrony' to 'chronyd'. LP: #1897915
2020-09-22Fix typo in resolv_conf module's description (#578)Wacław Schiller
2020-09-22cc_users_groups: minor doc formatting fix (#577)Daniel Watkins
Co-authored-by: Rick Harding <rharding@mitechie.com>
2020-09-21Fix typo in disk_setup module's description (#579)Wacław Schiller
2020-09-15create a shutdown_command method in distro classes (#567)Emmanuel Thomé
Under FreeBSD, we want to use "shutdown -p" for poweroff. Alpine Linux also has some specificities. We choose to define a method that returns the shutdown command line to use, rather than a method that actually does the shutdown. This makes it easier to have the tests in test_handler_power_state do their verifications. Two tests are added for the special behaviours that are known so far.
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-08-25tox: bump the pylint version to 2.6.0 in the default run (#544)Paride Legovini
Changes: tox: bump the pylint version to 2.6.0 in the default run Fix pylint 2.6.0 W0707 warnings (raise-missing-from)
2020-08-21Update the list of valid ssh keys. (#487)Ole-Martin Bratteng
Update ssh_util.py with latest list of keys (from openssh-8.3p1/sshkey.c), Added keys: sk-ecdsa-sha2-nistp256-cert-v01@openssh.com sk-ecdsa-sha2-nistp256@openssh.com sk-ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com ssh-xmss-cert-v01@openssh.com ssh-xmss@openssh.com LP: #1877869
2020-08-19Add Alpine Linux support. (#535)dermotbradley
Add new module cc_apk_configure for creating Alpine /etc/apk/repositories file. Modify cc_ca_certs, cc_ntp, cc_power_state_change, and cc_resolv_conf for Alpine. Add Alpine template files for Chrony and Busybox NTP support. Add Alpine template file for /etc/hosts.
2020-08-18Detect kernel version before swap file creation (#428)Eduardo Otubo
According to man page `man 8 swapon', "Preallocated swap files are supported on XFS since Linux 4.18". This patch checks for kernel version before attepting to create swapfile, using dd for XFS only on kernel versions <= 4.18 or btrfs. Add new func util.kernel_version which returns a tuple of ints (major, minor) Signed-off-by: Eduardo Otubo otubo@redhat.com
2020-08-13Fix 'Users and Groups' configuration documentation (#530)sshedi
Few of the 'User and Groups' configurations in cloud-config have no effect on already existing users. This was not documented earlier. This change set adds that information to documentation. Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2020-08-10Fix a typo in apt pipelining module (#525)Xiao Liang
* Fix a typo in apt pipelining module Changed `whcih` to `which`. * Update .github-cla-signers I have signed the CLA on Canonical's site, adding my username to list of CLA signers. * Update .github-cla-signers I need to sort the list alphabetically.
2020-07-15cc_ca_certs.py: fix blank line problem when removing CAs and adding new one ↵dermotbradley
(#483) Problem: When cc_ca_certs configuration has both "remove-defaults: true" and also specifies one, or more, new trusted CAs to add then the resultant /etc/ca-certificates.conf file's 1st line is blank. As noted in comments in the existing cc_ca_certs.py code blank lines in this file cause problems. Fix: Before adding the cloud-init CA filename to this file first check the size of the file - if is is empty (as all existing CAs have been deleted) then write only the cloud-init CA filename to the file rather than appending it to the file.
2020-07-15cloudinit: remove global disable of pylint W0107 and fix errors (#489)Daniel Watkins
* cloudinit: remove global disable of pylint W0107 and fix errors This includes removing a test class which contained no tests but wasn't detected as empty because of an errant pass statement. * .pylintrc: update disable comment to match arguments
2020-07-13cloudinit: remove global disable of pylint W0105 and fix errors (#480)Daniel Watkins
This includes a fix to a test that had a string concatenation issue, and so was only testing a prefix of what was intended.
2020-07-13Fix two minor warnings (#475)Daniel Watkins