summaryrefslogtreecommitdiff
path: root/cloudinit/sources
AgeCommit message (Collapse)Author
2016-10-07MAAS: improve the main of datasource to look at kernel cmdline config.Scott Moser
This just looks in one other maas related path for a config file. The file '91_kernel_cmdline_url' is written by cloud-init when it gets a cloud-config-url parameter. Also now we read the config even if a url is specified to potentially fill in credentials.
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-20Adjust mounts and disk configuration for systemd.Scott Moser
The end result of all of these changes is to get mounts managed by cloud-init to occur only after cloud-init.service is done. We need to do that so that filesystems that are set up by cloud-init (in disk_setup) do not get mounted by stale entries in /etc/fstab before the setup occurs. This can occur in 2 ways: a.) new instance with old /etc/fstab b.) same instance where disk needs adjusting (Azure resize will re-format the ephemeral disk). The list of changes here is: - move mounts and disk_setup module to cloud-init.service rather than config. cloud-init.service runs earlier in boot so it can get those mount points done earlier. - on systemd add 'x-systemd.requires=cloud-init.service' to fstab options - cloud-init-local.service: add Before=basic.target - cloud-init.service: - extend After, Before, and Wants to multiple lines rather than one long line. - sort consistently with cloud-init-local.service - add DefaultDependencies=no - add Before=default.target - add Conflicts=shutdown.target LP: #1611074
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-23add install option for openrcMatthew Thode
Adds an install option for for OpenRC init scripts. I've also restricted installing tests more correctly. Also, don't hardcode the path to ip (/bin/ip on gentoo).
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-22azure dhclient-hook cleanupsScott Moser
This adds some function to the generator to maintain the presense of a flag file '/run/cloud-init/enabled' indicating that cloud-init is enabled. Then, only run the dhclient hooks if on Azure and cloud-init is enabled. The test for is_azure currently only checks to see that the board vendor is Microsoft, not actually that we are on azure. Running should not be harmful anywhere, other than slowing down dhclient. The value of this additional code is that then dhclient having run does not task the system with the load of cloud-init. Additionally, some changes to config are done here. * rename 'dhclient_leases' to 'dhclient_lease_file' * move that to the datasource config (datasource/Azure/dhclient_lease_file) Also, it removes the config in config/cloud.cfg that set agent_command to __builtin__. This means that by default cloud-init still needs the agent installed. The suggested follow-on improvement is to use __builtin__ if there is no walinux-agent installed.
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-08-08Newer requests have strong type validationJoshua Harlow
Only use strings in headers, as newer requests actually do stricter validation of this, so ensure that we comply by only having string objects in header dicts.
2016-07-13merge from trunkScott Moser
2016-07-13ConfigDrive: write 'injected' files and legacy networkingScott Moser
Previous commit disabled the consumption of 'injected' files in configdrive (openstack server boot --file=/target/file=local-file) unless the datasource was in 'pass' mode. The default mode is 'net' so that would never happen. Also here are: a.) a fix for 'links_path_prefix' string from debian, to finally disable the rendering of systemd.link files (LP: #1594546) b.) some comments to apply_network_config c.) implement a backwards compatibility for for distros that do not yet implement apply_network_config by converting the network config into ENI format and calling apply_network. This is required because prior to the previous commit, those distros would have had 'apply_network' called with the openstack provided ENI file. But after this change they will have apply_network_config called by cloudinit's main. d.) a network_state_to_eni helper for converting net config to eni it supports the not-actually-correct 'hwaddress' field in ENI. LP: #1602373
2016-07-13Fix SmartOS datasource usage of dict comprehensionsJoshua Harlow
2016-07-13Another stray occurence of a dict comprehension being removedJoshua Harlow
2016-07-13Remove another stray dict comprehensionJoshua Harlow
2016-06-27fix restoring from a datasource that did not have dsmodeScott Moser
On upgrade and reboot, if datasource restored from obj.pkl did not have a dsmode attribute, then 'init --local' would fail due to stack trace. LP: #1596690
2016-06-15DataSourceNoCloud: fix stack trace on reboot, default to dsmode=netScott Moser
On reboot (loading module from obj.pkl) we would hit a AttributeError when trying to access cmdline_id. Addtionally, dsmode was inadvertantly defaulting to local for DataSourceNoCloud. LP: #1592505
2016-06-15remove declaration of dsmode as local in DataSourceNoCloudScott Moser
this would cause the datasource to operate in local mode by default.
2016-06-15fix usage of OSError.message that will not work in python3Scott Moser
python3's OSError does not have a .message attribute.
2016-06-15merge from trunkScott Moser
2016-06-15fix some errors reported by pylintScott Moser
pylint --errors-only found several errors. Some of the changes here represent real errors, others just code that pylint did not like.
2016-06-15merge with trunkScott Moser
2016-06-15merge with trunkScott Moser
2016-06-15fis some Datasourcenocloud issuesScott Moser
LP: #1592505
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-14[Revert] Remove trailing dot from GCE metadata URLScott Moser
This change broke tox tests.
2016-06-13Removes trailing dot in metadata.google.internal GCE metadata lookup.Phil Roche
A bug was reported (lp:1581200) where if there is no DNS server configured or it is not running then the metadata lookup on GCE will fail as it contains a trailing dot 'metadata.google.internal.'. As there is no DNS configured or running it will use the /etc/hosts file but the hosts file does not contain an entry with the trailing dot. One solution is to add an entry to the /etc/hosts file with the trailing dot but according to the manpage, /etc/hosts entries must end with an alphanumeric character and cannot end with a dot. The trailing dot was added to avoid MIM by dns search but we should probably assume the instance being started has no DNS and as such when querying metadata should use a URL that will resolve using /etc/hosts. LP: #1581200
2016-06-10Just mock 'on_first_boot' vs special argumentJoshua Harlow
2016-06-06Rebase against masterJoshua Harlow
2016-06-03config drive conversion: recognize 'bridge' as a physical type, fix mtuScott Moser
the network json in openstack provides a type of 'bridge' when the underlying (host) type is a bridge. Silly, but we need to consider that a physical device as it will be for us. also, the 'mtu' will appear on the link, not on the route
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-02re-add the 'Net' classes for datasourcesScott Moser
When the .pkl file is loaded, the module that it is loaded from must have the same symbol. Ie, if booted once and got DataSourceConfigDriveNet then upgraded and rebooted, then next boot would show Can't get attribute 'DataSourceConfigDriveNet'
2016-06-02fix untested previous change to smartosScott Moser
2016-06-02smartos: do not raise error when not on smartosScott Moser
if get_smartos_environ() returned a None, then the datasoure would raise a ValueError when get_data was called. Fix that.
2016-06-02openstack: support decoding when reading files, use that for network_configScott Moser
The network config file is /etc/network/interfaces formated. We will decode that here so that the user can expect that it is a string. The issue was that it was bytes but convert_eni_data was expecting a string.
2016-06-02SmartOS: datasource improvements, support for networking information.Scott Moser
This adds support for reading networking information from the SmartOS metadata service and applying.
2016-05-31use constants for kvm and lx-brandScott Moser
2016-05-27return dict not None on get_config_objScott Moser
2016-05-27smartos is local, but it is named DataSourceSmartOS not DataSourceConfigDriveScott Moser
2016-05-27Smartos datasource is local.Scott Moser
2016-05-27add nicer mainScott Moser
2016-05-27remove debug printScott Moser
2016-05-27fix pyflakes and flake8Scott Moser
2016-05-27fix the remaining testsScott Moser
2016-05-27fix a bunch of the testsScott Moser