summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-10-19Move user/group functions to new ug_util fileJoshua Harlow
The amount of code to do user and group normalization and extraction deserves its own file so move the code that does this to a new file and update references to the old location. This removes some of the funkyness done in config modules to avoid namespace and attribute clashes as well.
2016-10-18DigitalOcean: enable usage of data source by default.Scott Moser
Just add DigitalOcean to the list of datasources that are used if there is no 'datasource_list' provided in config.
2016-10-18update Gentoo initscripts to run in the correct orderMatthew Thode
cloud-init-local needs to be run before net (and in the boot runlevel) as it sets up networking config and adds it to the default runlevel. cloud-init-local needs to be run in the boot runlevel because it modifies services in the default runlevel. When a runlevel is started it is cached, so modifications that happen to the current runlevel while you are in it are not acted upon. cloud-init needs to run after net, it does not need net because we still want it to set up other things if it can.
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-10-07tests: silence the Cheetah UserWarning about NameMapper C version.Scott Moser
This silences a warning made by Cheetah in pip installed environments: UserWarning: You don't have the C version of NameMapper installed! I'm disabling Cheetah's useStackFrames option ... The reason for the monkey patching is that the warning goes to stderr during nose and breaks up its expected output. The side affect of it is that tests would run with Cheetah's 'useStackFrames' enabled which is "painfully slow with the Python version of NameMapper".
2016-10-07systemd: Run cloud-init.service Before dbus.socket not dbus.targetDaniel Watkins
The change reported to fix bug 1629797 was incorrect. It added: Before=dbus.target and its commit message referenced dbus.service. dbus.target does not exist, and dbus.service would not solve the problem. The change did not fix the problem nor actually make any difference. The fix here is just to use Before=dbus.socket. LP: #1629797
2016-10-04systemd: run cloud-init.service Before dbus.serviceScott Moser
This is the best work around we have for an issue seen when dns is used during cloud-init.service on a system that is configured in nsswitch to use systemd-resolved. The problem is that cloud-init.service was blocking basic.target, and dbus would not be available until after cloud-init.service finished. LP: #1629797
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-30Improve module documentation and doc cleanup.Wesley Wiedenmeier
This adds lots of config module documentation in a standard format. It will greatly improve the content at readthedocs. Additionally: * Add a 'doc' env to tox.ini * Changed default highlight language for sphinx conf from python to yaml most examples in documentation are yaml configs * Updated datasource examples to highlight sh code properly
2016-09-29lxd: Update network config for LXD 2.3Stéphane Graber
Prior to LXD 2.3, the bridge configuration was done through distro packaging. Thus, lxd module interacted with debconf. With 2.3 and higher, this is now done inside LXD itself, so we need to use "lxc network" there. For now, this perfectly matches what we had before with debconf and doesn't cover any of the new options. We can always add those later. A set of tests similar to what we had for debconf has been added to make sure things look good. This is tested in Yakkety container running LXD 2.3 and all options seem to be passed through as expected, giving me the bridge I defined. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
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-28ntp: move to run after apt configurationScott Moser
since ntp module may try to install packages, it needs to run after apt is configured. LP: #1628337
2016-09-21Decode unicode types in decode_binaryRobert Schweikert
The test in decode_binary for six.text_type was incorrect as that includes unicode type in Python 2 which should actually be decoded. When the type is string_types we now properly check only for basestring and str in Python 2 and Python 3 respectively and return the given blob without making an attempt to decode.
2016-09-21systemd: Ensure that cloud-init-local happens before NetworkManagerJoshua Harlow
2016-09-21Allow ephemeral drive to be unpartitionedPaul Meyer
If device has no partition table, the first line of output from `sgdisk -p <device>` will be "Creating new GPT entries.", instead of something like "Disk /dev/sdb: 266338304 sectors, 127.0 GiB". Also, protect against localized output by adjusting subp calls that parse sgdisk output to set LANG=C.
2016-09-21subp: add 'update_env' argumentScott Moser
In order for a caller to use 'env' argument of subp, they will realistically do: env = os.environ.copy() env['FOO'] = 'BZR' subp(cmd, env=env) This shortens that to be: subp(cmd, update_env={'FOO': 'BZR'}) Add tests, and update growpart tests to use mock when playing with os.environ.
2016-09-21net: support reading ipv6 dhcp config from initramfsLaMont Jones
This adds support for understanding 'dhcp6' as a protocol that can be written into /run/net-IFACE.cfg files by the initramfs. The end result is supporting ipv6 dhcp from initramfs boot all the way into iscsi root. LP: #1621615, #1621507
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-15dmidecode: run dmidecode only on i?86 or x86_64 arch.Robert Schweikert
Dmidecode is not going to run successfully on anything other than an x86 or x86_64, just avoid running it anywhere else.
2016-09-15systemd: put cloud-init.target After multi-user.targetScott Moser
When we moved cloud-final.service to run After multi-user.target it caused a dependency loop (as cloud-init.target was still implied to be Before multi-user.target). journalctl would either show: cloud-init.target: Breaking ordering cycle by deleting job cloud-final.service/start or multi-user.target: Breaking ordering cycle by deleting job cloud-init.target/start The fix here is to clearly state that cloud-init.target is also After multi-user.target LP: #1623868
2016-09-12release 0.7.8Scott Moser
Bump the version in cloudinit/version.py to be 0.7.8.
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-09-12remove obsolete .bzrignoreScott Moser
2016-09-09systemd: Better support package and upgrade.Scott Moser
In systemd, package installation before the system is fully booted (systemctl is-system-running == starting) may result in the package not being started. Upgrade (package_upgrade: true) can also cause failure if that is done during systemd boot. The solution here is: a.) move config modules that do or may do package installation to 'final_modules'. That list is: - snappy - package-update-upgrade-install - fan - landscape - lxd - puppet - chef - salt-minion - mcollective b.) move cloud-final.service to run as 'Type=idle' LP: #1576692, #1621336
2016-09-08tests: cleanup tempdirs in apt_source testsScott Moser
test_handler_apt_source_v3.py was not cleaning up all its tmp dirs.
2016-09-08apt config conversion: treat empty string as not provided.Scott Moser
Old behavior allowed a user to provide: apt_mirror: "" And that was the same as: apt_mirror: null and the same as having not specified apt_mirror at all. This maintains that behavior for all old string values. LP: #1621180
2016-09-02Fix typo in default keys for phone_homeRoland Sommer
This should be fqdn, not fdqn. LP: #1607810
2016-09-01salt minion: update default pki directory for newer salt minion.Scott Moser
Assuming that the installed package creates the directory /etc/salt/pki/minion (ubuntu yakkety does), this will pick that directory for the pki_dir default. If it does not exist, then it will maintain the old directory. LP: #1609899
2016-08-31bddeb: add --release flag to specify the release in changelog.Scott Moser
./packages/bddeb --release=xenial that will get you a changelog with Distribution of xenial rather than UNRELEASED.
2016-08-26apt-config: allow both old and new format to be present.Christian Ehrhardt
This allows both v1/2 and and v3 formats to exist in config. If both are present, then prefer v3. If values are not the same then a ValueError is raised. LP: #1616831
2016-08-25python2.6: fix dict comprehension usage in _lsb_release.Joshua Harlow
This syntax doesn't work in python 2.6
2016-08-23Add a module that can configure spacewalk.Joshua Harlow
Spacewalk is used by some peopel to manage connections into redhat package management systems and kickstart and various other tasks, so having a system be able to do the needed tasks on first boot to integrate with that system would be very useful (to some). See: https://fedorahosted.org/spacewalk/
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-22network: fix get_interface_mac for bond slave, read_sys_net for ENOTDIRScott Moser
When using get_interface_mac, on a system with bond slaves, it would return the bond_master's address. That isn't expected, and causes problems in a caller like get_interfaces_by_mac which would then seem to find duplicate macs on the system. Additionally, in read_sys_net catch a errno.ENOTDIR error as ENOENT. Opening a path as a file that has <existing_file>/anything will will raise ENOTDIR rather than ENOENT. This handles that case in read_sys_net as a if the file did not exist.
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-22Minor cleanups to atomic_helper and add unit tests.Scott Moser
Change atomic_helper.write_file to have same same signature as write_file. Add some simple unit tests for atomic_helper.
2016-08-22Fix Gentoo net config generationMatthew Thode
This gets Gentoo work on simple configs with static IPs or DHCP on physical interfaces. This gets Gentoo bootable again.
2016-08-18distros: fix get_primary_arch method use of os.unameAndrew Jorgensen
os.uname is a method, not a property.
2016-08-18Apt: add new apt configuration formatChristian Ehrhardt
This adds an improved apt configuration format that is fully backwards compatible with previous behavior. This is mostly copied from curtin's implementation. It does: * clean up and centralizes many of the top level 'apt_*' values that previously existed into a single top level 'apt'key. * support a 'source' in apt/sources/entry that has only a key * documents new features and adds tests. See the added doc/examples/cloud-config-apt.txt for more information.
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-11Upgrade to a configobj package new enough to workJoshua Harlow
The older versions have various issues with unicode and those versions seem to be pulled into epel so we should denote that those versions are bad and shouldn't be used by updating to a newer version that does work.
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-10Add distro tags on config modules that should have itJoshua Harlow
Some of these really won't work to well on non-supporting distros so to avoid further user pain tag this with the supported distros where they should work.
2016-08-10ChangeLog: update changelog for previous commit.Scott Moser
2016-08-10add ntp config moduleRyan Harper
Add support for installing and configuring ntp service, exposing the minimum config of servers or pools to be added. If none are defined then fallback on generating a list of pools by distro hosted at pool.ntp.org (which matches what's found in the default ntp.conf shipped in the respective distro).