summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-10-03Azure, CloudStack: Support reading dhcp options from systemd-networkd.Dimitri John Ledkov
Systems that used systemd-networkd's dhcp client would not be able to get information on the Azure endpoint (placed in Option 245) or the CloudStack server (in 'server_address'). The change here supports reading these files in /run/systemd/netif/leases. The files declare that "This is private data. Do not parse.", but at this point we do not have another option. LP: #1718029
2017-10-02packages/debian/copyright: remove mention of boto and MIT licenseScott Moser
boto_utils.py had been removed some time ago, and the current cloudinit/ec2_utils.py is not based on what was in boto_utils. We just failed to remove the mention of it from the upstream debian/copyright. And then put it back in everywhere in recent changes to get upstream and ubuntu in sync.
2017-10-02systemd: only mention Before=apt-daily.service on debian based distros.Robert Schweikert
Ordering on apt service should only be set up on Debian based distributions. This changes is really a net-zero in runtime result. But, mentioning apt on a rpm based distro could be confusing.
2017-10-02Add missing simpletable and simpletable tests for failed mergeChad Smith
2017-10-02Remove prettytable dependency, introduce simpletableAndrew Jorgensen
The first revision of this rendered tables with less decoration but there was a desire upstream to avoid possibly breaking some parsing someone might be doing, so it has been revised to render the same as prettytable for the cases cloud-init actually uses.
2017-09-29debian/copyright: dep5 updates, reorganize, add Apache 2.0 license.Joshua Powers
The copyright was updated to be lintian clean and reorganized to list the licenses at the bottom after declaring the metadata and file information. Add the MIT license to the file. LP: #1718681
2017-09-25tests: remove dependency on shlexJoshua Powers
This removes shlex and converts the subprocess commands to use a list over a string.
2017-09-25AltCloud: Trust PATH for udevadm and modprobe.Scott Moser
Previously we had hard coded paths in /sbin for the udevadm and modprobe programs invoked by AltCloud. Its more flexible to expect the PATH to be set correctly. Debian: #852564
2017-09-22DataSourceOVF: use util.find_devs_with(TYPE=iso9660)Ryan Harper
DataSourceOVF attempts to find iso files via walking os.listdir('/dev/') which is far too wide. This approach is too invasive and can sometimes race with systemd attempting to fsck and mount devices. Instead, utilize cloudinit.util.find_devs_with to filter devices by criteria (which uses blkid under the covers). This results in fewer attempts to mount block devices which do not contain iso filesystems. Unittest changes include: - cloudinit.tests.helpers; introduce add_patch() helper - Add unittest coverage for DataSourceOVF use of transport_iso9660 LP: #1718287
2017-09-21tests: remove a temp file used in bootcmd tests.Scott Moser
The bootcmd test was leaving files in the tmpdir named ci-FakeExtendedTempFile.XXXXXX. This cleans those up.
2017-09-21release 17.1Scott Moser
Bump the version in cloudinit/version.py to be 17.1 and update ChangeLog.
2017-09-21doc: document GCE datasource.Arnd Hannemann
Add some minimal documentation for GCE datasource.
2017-09-21suse: updates to templates to support openSUSE and SLES.Robert Schweikert
Things done here: - identify 'suse' as a variant in util.system_info and also tools/render-cloudcfg. - update systemd and cloud.cfg templates for suse specific changes. LP: #1718640
2017-09-21suse: Copy sysvinit files from redhat with slight changes.Robert Schweikert
Here we commit the SuSE provided sysvinit scripts. They are very similar to those in redhat/ directory. They differ in small but important ways. Rather than build a template system here we will just accept the copy and paste. sysvinit in both RedHat and SuSE is EOL, so we do not expect any real maintenance cost here. LP: #1718649
2017-09-20docs: fix sphinx module schema documentationChad Smith
Create a copy of each modules schema attribute when generating sphinx docs to avoid altering the actual module dict in memory. This avoids illegible rendering of module examples and distros where each character of a list was represented on a separate line by itself. Fixes ntp, resizefs, runcmd and bootcmd docs.
2017-09-20tests: Add cloudinit package to all test targetsChad Smith
The package cloudinit was sparsely added to only the makefile's unittest target and tox's py3 target. This branch adds cloudinit package to 'make unittest3' and all tox environments. It tweaks one cloudinit unit test to use mocked_object.call_count instead of mocked_object.assert_called_once which is not defined in some python unittest versions.
2017-09-20Makefile: No longer look for yaml files in obsolete ./bin/.Scott Moser
The bin/ dir was deleted some time ago, but the Makefile was still searching for files down it. This didn't cause any problems other Than a wierd looking error message in a build log.
2017-09-19tests: fix ds-identify unit tests to set EC2_STRICT_ID_DEFAULT.Scott Moser
The variable DI_EC2_STRICT_ID_DEFAULT was not being set in unit tests so when 16.04 built, which changed that setting in patches the tests would unexpectedly fail.
2017-09-18ec2: Fix maybe_perform_dhcp_discovery to use /var/tmp as a tmpdirChad Smith
/run/cloud-init/tmp is on a filesystem mounted noexec, so running dchlient in Ec2Local during discovery breaks with 'Permission denied'. This branch allows us to run from a different tmp dir so we have exec rights. LP: #1717627
2017-09-18Azure: wait longer for SSH pub keys to arrive.Paul Meyer
Currently the Azure data source waits up to 60 seconds. This has proven not to be sufficient to provide resiliency to unrelated transient failures in other parts of the infrastructure. Azure already has logic outside of the VM to abort hung provisioning. This changes lengthens the time out to 15 minutes. LP: #1717611
2017-09-18GCE: Fix usage of user-data.Scott Moser
This regressed in the rework of GCE datasource to have a main. The fix really just stores the user-data that was read in self.userdata_raw, rather than self.userdata. That is consistent with other datasources and ulitimately how it was before the refactor. The main is updated to address the fact that user-data is binary data and may not be able to be printed. LP: #1717598
2017-09-15cmdline: add collect-logs subcommand.Chad Smith
Add a new collect-logs sub command to the cloud-init CLI. This script will collect all logs pertinent to a cloud-init run and store them in a compressed tar-gzipped file. This tarfile can be attached to any cloud-init bug filed in order to aid in bug triage and resolution. A cloudinit.apport module is also added that allows apport interaction. Here is an example bug filed via ubuntu-bug cloud-init: LP: #1716975. Once the apport launcher is packaged in cloud-init, bugs can be filed against cloud-init with the following command: ubuntu-bug cloud-init LP: #1607345
2017-09-15CloudStack: consider dhclient lease files named with a hyphen.Scott Moser
A regression in 'get_latest_lease' made it ignore files starting with 'dhclient-' rather than just 'dhclient.'. The fix here is to allow those files to be considered. There is a lot more we could do here to better ensure that we pick the most recent lease, but this change fixes the regression. LP: #1717147
2017-09-15resizefs: Drop check for read-only device file, do not warn on overlayroot.Chad Smith
As root user, os.access(<path>, os.W_OK) will always return True so that path will never get executed. Also avoid a warning if the root is overlayroot, which is the common case on a MAAS booted 'ephemeral' system.
2017-09-15Do not provide systemd-fsck drop-in which could cause ordering cycles.Balint Reczey
Revert "centos: do not package systemd-fsck drop-in." Revert "systemd: make systemd-fsck run after cloud-init.service" The systemd-fsck drop-in caused regressions by introducing ordering The change reverts the original commit that added systemd-fsck drop-in and another commit that had removed that from the centos packaging: 1f5489c258a26f4e26261c40786537951d67df1e 8a5296c41db45be3a172862f324ad44e732a2250 The result is to no longer provide the systemd-fsck drop-in. LP: #1717477
2017-09-14tests: Enable the NoCloud KVM platformJoshua Powers
The NoCloud KVM platform includes: * Downloads daily Ubuntu images using streams and store in /srv/images * Image customization, if required, is done using mount-image-callback otherwise image is untouched * Launches KVM via the xkvm script, a wrapper around qemu-system, and sets custom port for SSH * Generation and inject an SSH (RSA 4096) key pair to use for communication with the guest to collect test artifacts * Add method to produce safe shell strings by base64 encoding the command Additional Changes: * Set default backend to use LXD * Verify not running script as root in order to prevent images from becoming owned by root * Removed extra quotes around that were added when collecting the cloud-init version from the image * Added info about each release as previously the lxd backend was able to query that information from pylxd image info, however, other backends will not be able to obtain the same information as easily
2017-09-14resizefs: pass mount point to xfs_growfsDusty Mabe
Supposedly it was never a feature to be able to pass a path to a block device to xfs_growfs and have it grow the filesystem. The behavior changed upstream recently. It is only supported to pass the mount point of a mounted XFS filesystem. This causes breakages in cloud-init. Upstream xfs change was commit b97815a0321072a7154ecab63e297af84066fc78. https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=b97815a0321 rhbz: rhbz: https://bugzilla.redhat.com/show_bug.cgi?id=1490505 Signed-off-by: Dusty Mabe <dusty@dustymabe.com>
2017-09-14vmware: Enable nics before sending the SUCCESS event.Sankar Tanguturi
The network devices should be enabled before sending the 'SUCCESS' event to the underlying hypervisor.
2017-09-13cloud-config modules: honor distros definitions in each moduleChad Smith
Modules can optionally define a list of supported distros on which they can run by declaring a distros attribute in the cc_*py module. This branch fixes handling of cloudinit.stages.Modules.run_section. The behavior of run_section is now the following: - always run a module if the module doesn't declare a distros attribute - always run a module if the module declares distros = [ALL_DISTROS] - skip a module if the distribution on which we run isn't in module.distros - force a run of a skipped module if unverified_modules configuration contains the module name LP: #1715738 LP: #1715690
2017-09-13chef: Add option to pin chef omnibus install versionEthan Apodaca
Most users of chef will want to pin the version that is installed. Typically new versions of chef have to be evaluated for breakage etc. This change proposes a new optional `omnibus_version` field to the chef configuration. The changeset also adds documentation referencing the new field. LP: #1462693
2017-09-13tests: execute: support command as stringJoshua Powers
If a string is passed to execute, then invoke 'bash', '-c', 'string'. That allows the less verbose execution of simple commands: image.execute("ls /run") compared to the more explicit but longer winded: image.execute(["ls", "/run"]) If 'env' was ever modified in execute or a method that it called, then the next invocation's default value would be changed. Instead use None and then set to a new empty dict in the method.
2017-09-13schema and docs: Add jsonschema to resizefs and bootcmd modulesChad Smith
Add schema definitions to both cc_resizefs and cc_bootcmd modules. Extend schema.py to parse and document enumerated json types. Schema definitions are used to generate module documention and log warnings for schema infractions. This branch also does the following: - drops vestigial 'resize_rootfs_tmp' option from cc_resizefs. That option only created the specified directory and didn't make use of that directory for any resize operations. - Drop yaml.dumps calls from schema documentation generation to avoid yaml import costs on module load - Add __doc__ = get_schema_doc(schema) definitions it each module to supplement python help() calls for cc_runcmd, cc_bootcmd, cc_ntp and cc_resizefs - Add a SCHEMA_EXAMPLES_SPACER_TEMPLATE string to docs for modules which contain more than one example
2017-09-13tools: Add xkvm script, wrapper around qemu-systemJoshua Powers
The xkvm script will be utilized by pending NoCloud qemu testing. If this turns out to not be the case, then we will drop it.
2017-09-07vmware customization: return network config formatSankar Tanguturi
For customizing the machines hosted on 'VMWare' hypervisor, the datasource should return the 'network config' data in 'curtin' format. This branch also fixes /etc/network/interfaces replacing the line "source /etc/network/interfaces.d/*.cfg" which is incorrectly removed when VMWare's Perl Customization Engine writes /etc/network/interfaces. Modify the code to read the customization configuration and return the converted data. Added few tests. LP: #1675063
2017-09-07Ec2: only attempt to operate at local mode on known platforms.Scott Moser
This change makes the DataSourceEc2Local do nothing unless it is on actual AWS platform. The motivation is twofold: a.) It is generally safer to only make this function available to Ec2 clones that explicitly identify themselves to the guest. (It also gives them a reason to supply identification code to cloud-init.) b.) On non-intel OpenStack platforms ds-identify would enable both the Ec2 and OpenStack sources. That is because there is not good data (such as dmi) to positively identify the platform. Previously that would be fine as OpenStack would run first and be successful. The change to add Ec2Local meant that an Ec2 now runs first. The best case for 'b' would be a slow down as attempts at the Ec2 metadata service time out. The discovered case was worse. Additionally we add a simple check for datatype of 'network' in the metadata before attempting to read it. LP: #1715128
2017-09-07Use /run/cloud-init for tempfile operations.Scott Moser
During boot, the usage of /tmp is not safe. In systemd systems, systemd-tmpfiles-clean may run at any point and clear out a temp file while cloud-init is using it. The solution here is to use /run/cloud-init/tmp. LP: #1707222
2017-09-07ds-identify: Make OpenStack return maybe on arch other than intel.Scott Moser
OpenStack Nova identifies itself only to Intel guests. Make ds-identify return 'MAYBE' for OpenStack on non-intel arches. An unnecessary change here is to rename the 'policy_nodmi' kwarg to 'policy_no_dmi' in the related unit tests. LP: #1715241
2017-09-06tests: mock missed openstack metadata uri network_data.jsonChad Smith
This missed mock in test_openstack resulted in a costly unit test timeout. LP: #1714376
2017-09-05relocate tests/unittests/helpers.py to cloudinit/testsLars Kellogg-Stedman
This moves the base test case classes into into cloudinit/tests and updates all the corresponding imports.
2017-09-01tox: add nose timer outputJoshua Powers
This adds the output of the nose timer plugin to the py3 environment to tox. This will print out the 10 longest running tests and automatically turn tests longer than 1 second "red" after the coverage output.
2017-08-31upstart: do not package upstart jobs, drop ubuntu-init-switch module.Scott Moser
The ubuntu-init-switch module allowed the use to launch an instance that was booted with upstart and have it switch its init system to systemd and then reboot itself. It was only useful for the time period when Ubuntu was transitioning to systemd but only produced images using upstart. Also, do not run setup with --init-system=upstart. This means that by default, debian packages built with packages/bddeb will not have upstart unit files included. No other removal is done here.
2017-08-31tests: Stop leaking calls through unmocked metadata addressesChad Smith
DataSourceEc2 behavior changed to first check a minimum acceptable metadata version uri http://169.154.169.254/<min_version>/instance-id, retrying on 404, until the metadata service is available. After the metadata service is up, the datasource inspects preferred extended_metadata_versions for availability. Unit tests only mocked the preferred extended_metadata_version so all Ec2 tests were retrying attempts against http://169.254.169.254/meta-data/<min-version>/instance-id adding a lot of time cost to the unit test runs. This branch uses httpretty to properly mock the following: - 404s from metadata on undesired extended_metadata_version test routes - https://169.254.169.254/meta-data/2016-09-02/instance-id - full metadata dictionary represented on min_metadata_version - https://169.254.169.254/meta-data/2016-09-02/* The branch also tightens httpretty to raise a MockError for any URL which isn't mocked via httpretty.HTTPretty.allow_net_connect=False. LP: #1714117
2017-08-30distro: allow distro to specify a default localeRyan Harper
Currently the cloud-init default locale (en_US.UTF-8) is set by the base datasource class. This patch allows a distro to overide the fallback value with one that's available in the distro but continues to respect an image which has preconfigured a locale. - Distro object now has a get_locale method which will return a preconfigure locale setting by checking the distros locale system configuration file. If not set or not present, return the default locale of en_US.UTF-8 which retains behavior of all previous cloud-init releases. - Apply locale now handles regenerating locales or system configuration files as needed. - Adjust apply_locale logic to skip locale-regen if the specified LANG value is C.UTF-8,C, or POSIX; they do not require regeneration. - Further add unittests to exercise the default paths for Ubuntu and non-ubuntu paths to validate they get the LANG expected.
2017-08-30tests: fix two recently added tests for sles distro.Scott Moser
test_set_locale_sles and test_set_locale_sles_default were incorrectly testing for truth of <distro_object>.uses_systemd rather than calling that function and checking its result. The error was only seen if the system running the tests was not using systemd.
2017-08-30url_helper: dynamically import oauthlib import from inside oauth_headersChad Smith
oauth_headers is the only function which requires oauthlib, move the import and ImportError handling inside this function to only attempt loading at runtime if called. This will allow us to build on platforms that don't have python-oauthlib installed by default. Add simple unittests around the missing oauthlib dependencies to make sure the function performs as intended and raises and NotImplementedError if oauthlib can't be imported.
2017-08-30tox: make xenial environment run with python3.6Scott Moser
The pinned versions of python packages in xenial do not work with python3.6. Currently, the failure can be seen with: $ tox -e xenial tests/unittests/test_merging.py which ends up failing with in /usr/lib/python3.6/inspect.py with: ValueError: Function has keyword-only parameters or annotations, use getfullargspec() API which can support them Instead of setting 'basepython' to 3.5 for the 'xenial', we just update the one package that does not run correctly with python3.6. That allows the developer to have either python3.5 or python3.6 installed and have tox work as expected.
2017-08-30suse: Add support for openSUSE and return SLES to a working state.Robert Schweikert
This gets initial opensuse and SLES support back to a working state. Still missing is more complete network file writing and unit tests.
2017-08-30GCE: Add a main to the GCE Datasource.Scott Moser
This just adds a main to the GCE datasource so that it is easily callable: python3 -m cloudinit.sources.DataSourceGCE It also adds a log of the time it took to crawl.
2017-08-29ec2: Add IPv6 dhcp support to Ec2DataSource.Chad Smith
DataSourceEc2 now parses the metadata for each nic to determine if configured for ipv6 and/or ipv4 addresses. In AWS for metadata version 2016-09-02, nics configured for ipv4 or ipv6 addresses will have non-zero values stored in metadata at network/interfaces/macs/<MAC>/public-ipv4 or ipv6s respectively. Those metadata files are only non-zero when an ipv4 or ipv6 ip is associated to the specific nic. A new DataSourceEc2.network_config property is added which parses the metadata and renders a network version 1 dictionary representing both dhcp4 and dhcp6 configuration for associated nics. The network configuration returned from the datasource will also 'pin' the nic name to the name presented on the instance for each nic. LP: #1639030
2017-08-29url_helper: fail gracefully if oauthlib is not availableLars Kellogg-Stedman
We are unable to ship python-oauthlib in RHEL. This commit allows imports of url_helper to succeed even when oauthlib is unavailable and OauthUrlHelper.oauth_headers to raise a NotImplementedException when called. LP: #1713760