summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource
AgeCommit message (Collapse)Author
2017-05-18cloudstack: fix tests to avoid accessing /var/lib/NetworkManagerLars Kellogg-Stedman
on centos/fedora/rhel, /var/lib/NetworkManager has mode 700, causing the cloudstack unit tests to fail when run as a non-root user. This mocks out get_latest_lease so that we no longer try to read dhcp lease information during the unit tests.
2017-05-17Azure: fix reformatting of ephemeral disks on resize to large types.Scott Moser
Large instance types have a different disk format on the newly partitioned ephemeral drive. So we have to adjust the logic in the Azure datasource to recognize that a disk with 2 partitions and an empty ntfs filesystem on the second one is acceptable. This also adjusts the datasources's builtin fs_setup config to remove the 'replace_fs' entry. This entry was previously ignored, and confusing. I've clarified the doc on that also. LP: #1686514
2017-05-10FreeBSD: improvements and fixes for use on AzureHongjiang Zhang
This patch targets to make FreeBSD 10.3 or 11 work on Azure. The modifications abide by the rule of: * making as less modification as possible * delegate to the distro or datasource where possible. The main modifications are: 1. network configuration improvements, and movement into distro path. 2. Fix setting of password. Password setting through "pw" can only work through pipe. 3. Add 'root:wheel' to syslog_fix_perms field. 4. Support resizing default file system (ufs) 5. copy cloud.cfg for freebsd to /etc/cloud/cloud.cfg rather than /usr/local/etc/cloud/cloud.cfg. 6. Azure specific changes: a. When reading the azure endpoint, search in a different path and read a different option name (option-245 vs. unknown-245). so, the lease file path should be generated according to platform. b. adjust the handling of ephemeral mounts for ufs filesystem and for finding the ephemeral device. c. fix mounting of cdrom LP: #1636345
2017-04-11DigitalOcean: bind resolvers to loopback interface.Ben Howard
This change makes the DigitalOcean datasource consistent with OpenStack and Joyent by binding the resolver addresses to the loopback interface. This _is_ a work-around to bug 1675571. Part of bug 1676908.
2017-04-11tests: fix AltCloud tests to not rely on blkidScott Moser
This just mocks out the AltCloud tests to not invoke blkid. Our tests should not rely on system command returning any specific value. Also, shorten long lines with change in the import name of DataSourceAltCloud. LP: #1636531
2017-03-31tests: update OpenNebula and Digital Ocean to not rely on host interfaces.Scott Moser
Mock the use use of get_interfaces_by_mac in Digital Ocean and OpenNebula. Its best to mock this for the tests as the results aren't expecting it to fail. Note, as it stands, OpenNebula relies on devices named 'eth0'. The metadata (context) does not provide mac addresses.
2017-03-27GCE: Search GCE in ds-identify, consider serial number in check.Scott Moser
While documentation indicates that the smbios product name should contain 'Google Compute Engine', experimentation and bug reports indicate that is not always the case. The change here is to change the check for GCE to also consider a serial number that starts with 'GoogleCompute-'. Also, ds-identify was not currently searching for GCE if no config of datasource_list was found. Most images have a datasource_list defined. So update the list to include GCE. LP: #1674861
2017-03-17render_network_state: switch arguments around, do not require targetScott Moser
render_network_state should default to rendering on /. The changes here just make it so render_network_state does not require a target, but defaults to None, and uses target_path to handle that.
2017-01-24tests: No longer monkey patch httpretty for python 3.4.2Scott Moser
No shipping ubuntu has a python 3.4 that is less than 3.4.2. Remove this workaround to avoid unnecessary complexity. This reverts 04a60cf949.
2017-01-24reset httppretty for each testLars Kellogg-Stedman
this ensures that we call httpretty.reset() before calling httppretty.register_uri(...), which ensures that we get a fresh callback with the expected version of the metadata. LP: #1658200
2017-01-17OpenStack: Use timeout and retries from config in get_data.Lars Kellogg-Stedman
This modifies get_data in DataSourceOpenStack.py to get the timeout and retries values from the data source configuration, rather than from keyword arguments. This permits get_data to use the same timeout as other methods, and allows an operator to increase the timeout in environments where the metadata service takes longer than five seconds to respond. LP: #1657130 Resolves: rhbz#1408589
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-12-11CloudSigma: Fix bug where datasource was not loaded in local search.Scott Moser
CloudSigma would not get any datasources loaded during cloud-init local. Thus, when the network datasource was removed, *no* CloudSigma datasources would be loaded. LP: #1648380
2016-11-22Azure: No longer rely on walinux agent.Scott Moser
Cloud-init has for some time relied on walinuxagent to do some bits of work necessary for instance initialization. That reliance has not been needed for a while, but we have still defaulted to it. This change uses the "builtin" path that Daniel Watkins added some time ago by default. Also, Adjust tests that assumed the non-__builtin__ Azure agent_command. LP: #1538522
2016-11-18Add activate_datasource, for datasource specific code paths.Scott Moser
This adds a call to 'activate_datasource'. That will be called during init stage (or init-local in the event of a 'local' dsmode). It is present so that the datasource can do platform specific operations that may be necessary. It is passed the fully rendered cloud-config and whether or not the instance is a new instance. The Azure datasource uses this to address formatting of the ephemeral devices. It does so by a.) waiting for the device to come online b.) removing the marker files for the disk_setup and mounts modules if it finds that the ephemeral device has been reset. LP: #1611074
2016-11-07pyflakes: fix issue with pyflakes 1.3 found in ubuntu zesty-proposed.Scott Moser
An obvious fix for an issue raised by pyflakes 1.3.
2016-11-01AliYun: Add new datasource for Ali-Cloud ECSkaihuan.pkh
Support AliYun(Ali-Cloud ECS). This datasource inherits from EC2, the main difference is the meta-server address is changed to 100.100.100.200. The datasource behaves similarly to EC2 and relies on network polling. As such, it is not enabled by default.
2016-10-19OpenNebula: replace 'ip' parsing with cloudinit.net usage.Scott Moser
Replace the parsing of 'ip' to get a link and mac address list in OpenNebula's datasource with usage of cloudinit.net. This makes test cases there not depend on 'ip' availability and also uses common code.
2016-10-04unittests: fix use of mock 2.0 'assert_called' when running make checkRyan Harper
Some of the new DigitalOcean unittests were written to use 'assert_called', which is only available in mock versions 2.0. Because of this, the failure would only occur in releases less than yakkety and not in 'tox'. Add a 'xenial' entry to tox.ini with versions from xenial.
2016-09-29DigitalOcean: use meta-data for network configruationBen Howard
On DigitalOcean, Network information is provided via Meta-data. It changes the datasource to be a local datasource, meaning it will run before fallback networking is configured. The advantage of that is that before networking is configured it can bring up a network device with ipv4 link-local and hit the metadata service that lives at 169.254.169.254 to find its networking configuration. It then takes down the link local address and lets cloud-init configure networking. The configuring of a network device to go looking for a metadata service is gated by a check of data in the smbios. This guarantees that the code will not run on another system.
2016-09-12Allow link type of null in network_data.jsonJon Grimm
Treat null type as yet another physical type, seen in real-world openstack cloud. Also, support the case where network_data.json provides mac addresses in upper case. Rackspace public cloud currently does that. LP: #1621968
2016-09-12DataSourceOVF: fix user-data as base64 with python3Scott Moser
When user-data was provided in the ovf environment python3 would call base64.decodestring() with a string rather than bytes and an exception would occur. This fixes the broken path and adds unit test. Also changes to return None rather than empty string when there is no user-data and when there is user-data return that as bytes instead of string. LP: #1619394
2016-08-23Generate a dummy bond name for OpenStackScott Moser
The OpenStack network_data.json does not provide a name for bond links. This change makes it so a dummy one is generated and used instead to satisfy cloud-init which does require one. In order to write the correct link (underlying 'link' names) for the bonds, we maintain a list of info by ids so we can easily get the right device name. Also: * add a vlan test case that similarly references an id rather than name. * make bond interfaces auto LP: #1605749
2016-08-15Get Azure endpoint server from DHCP clientBrent Baude
It is more efficient and cross-distribution safe to use the hooks function from dhclient to obtain the Azure endpoint server (DHCP option 245). This is done by providing shell scritps that are called by the hooks infrastructure of both dhclient and NetworkManager. The hooks then invoke 'cloud-init dhclient-hook' that maintains json data with the dhclient options in /run/cloud-init/dhclient.hooks/<interface>.json . The azure helper then pulls the value from /run/cloud-init/dhclient.hooks/<interface>.json file(s). If that file does not exist or the value is not present, it will then fall back to the original method of scraping the dhcp client lease file.
2016-08-12DigitalOcean: use the v1.json endpointBen Howard
Per [1], DigitalOcean provides the metadata in multiple formats. The JSON document is the preferred endpoint. Changes: - Switch to the v1.json meta-data endpoint - Identify droplet identity from SMBIOS - Only poll for metadata when the instance is confirmed to be a droplet - Removal of hard-coded mirrors Additionally, centralize the gates on running 'dmidecode' on arm arches, and update tests to address. [1] https://developers.digitalocean.com/documentation/metadata/
2016-08-12MAAS: add vendor-data supportScott Moser
Add vendor-data support to maas which will behave like the openstack vendor-data does. Data returned from maas must be yaml loadable. Also update the main in DataSourceMAAS to "just work" on a maas deployed system. LP: #1612313
2016-08-11ConfigDrive: recognize 'tap' as a link type.Scott Moser
This just adds 'tap' to the list of types that are understood to be physical or virtual network devices. Openstack basically exposes the type of the host device through. LP: #1610784
2016-08-11NoCloud: fix bug providing network-interfaces via meta-data.Scott Moser
This fixes an issue with the NoCloud datasource where it would not recognize the 'network-interfaces' key provided in meta-data. LP: 1577982
2016-08-10SmartOS: more improvements for network configurationScott Moser
This improves smart os network configuration - fix the SocketClient which was previously completely broken. - adds support for configuring dns servers and dns search (based off the sdc:dns_domain). - support 'sdc:gateways' information from the datasource for configuring default routes. - add converted network information to output when module is run as a main This does not support 'sdc:routes' as described at http://eng.joyent.com/mdata/datadict.html
2016-06-15Re-apply "Remove trailing dot from GCE metadata URL (LP: #1581200) [Phil Roche]"Daniel Watkins
This commit includes the content of that commit, plus a fix for the tests (provided by Phil).
2016-06-10Refactor a large part of the networking code.Joshua Harlow
Splits off distro specific code into specific files so that other kinds of networking configuration can be written by the various distro(s) that cloud-init supports. It also isolates some of the cloudinit.net code so that it can be more easily used on its own (and incorporated into other projects such as curtin). During this process it adds tests so that the net process can be tested (to some level) so that the format conversion processes can be tested going forward.
2016-06-10Just mock 'on_first_boot' vs special argumentJoshua Harlow
2016-06-10Just do all the imports on one lineJoshua Harlow
2016-06-10remove unused importScott Moser
2016-06-10one moreScott Moser
2016-06-10fix one large source of leaked tmpfilesScott Moser
2016-06-06Rebase against masterJoshua Harlow
2016-06-03fix issue with routes on subnets not getting renderedScott Moser
2016-06-02ConfigDrive: do not use 'id' on a link for the device nameScott Moser
'id' on a link in the openstack spec should be "Generic, generated ID". current implementation was to use the host's name for the host side nic. Which provided names like 'tap-adfasdffd'. We do not want to name devices like that as its quite unexpected and non user friendly. So here we use the system name for any nic that is present, but then require that the nics found also be present at the time of rendering. The end result is that if the system boots with net.ifnames=0 then it will get 'eth0' like names. and if it boots without net.ifnames then it will get enp0s1 like names.
2016-06-02fix toxScott Moser
2016-05-27assertEqualScott Moser
2016-05-27assertEqualsScott Moser
2016-05-27add a unit test for conversionScott Moser
2016-05-27fix pyflakes and flake8Scott Moser
2016-05-27fix the remaining testsScott Moser
2016-05-27fix a bunch of the testsScott Moser
2016-05-27merge from trunkScott Moser
2016-05-26Move sdc:nics to a JSON map. Add unittest for sdc:nicsRyan Harper
2016-05-19Fix up tests and flake8 warningsJoshua Harlow
2016-05-19Remerge against head/masterJoshua Harlow