summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-12-03when adding a user, strip whitespace from group listLars Kellogg-Stedman
The documentation shows group names in the 'groups:' key delimited by ", ", but this will result in group names that contain spaces. This can cause the 'groupadd' or 'useradd' commands to fail. This patch ensures that we strip whitespace from either end of the group names passed to the 'groups:' key. LP: #1354694
2016-12-02fix decoding of utf-8 chars in yaml testScott Moser
Python 3 would fail to load yaml from doc/examples/cloud-config-apt.txt when the LANG (specifically LC_CTYPE) was 'C'. The changes here do 2 things: a.) remove the non-ascii characters from the yaml file. b.) fix the validate-yaml.py program to decode using utf-8 specifically rather than using the inherited settings. This fixes it now for ascii and in the future also should non-ascii slip in.
2016-12-02Replace usage of sys_netdev_info with read_sys_netJoshua Harlow
I've seen cases of unable to read from files as well as the existing os errors so catch io error and skip by using the smarter read_sys_net instead. LP: #1625766
2016-12-02fix problems found in python2.6 test.Joshua Harlow
These are just simple syntax fixes to work correctly on python2.6. Found when testing in a centos 6 container.
2016-11-28OpenStack: extend physical types to include hyperv, hw_veb, vhost_user.Scott Moser
This extends the list of device 'types' that are considered to be physical to include hyperv, hw_veb, and vhost_user. LP: #1642679
2016-11-22tests: fix assumptions that expected no eth0 in system.Scott Moser
The previous commit added tests that would fail on any system that had a nic named eth0 or eno1. The changes here supply the expected macs to the function being tested so it does not query the system. LP: #1644043
2016-11-22net/cmdline: Consider ip= or ip6= on command line not only ip=Scott Moser
The previous behavior would miss ip6= on the command line and would not pay attention to the written net-* or net6-* files if only ip6= was found. The fix here enables parsing the files if either ip= or ip6= is found, and adds some tests as well. LP: #1639930
2016-11-22Just use file logging by defaultJoshua Harlow
Instead of being dependent on the availability of syslog that various distributions may not enable or configure correctly or they do so via patches just use a known-to-work default logging mechanism. If distros want to change this, that is fine, but at least the built-in one will work reliably. LP: #1643990
2016-11-22Improve formatting for ProcessExecutionErrorWesley Wiedenmeier
This replaces long single lines in a log or console output with multiple lines that are much easier to read. It indents the stdout and stderr so logs are more easily read also.
2016-11-22flake8: fix trailing white spaceScott Moser
2016-11-22Doc: various documentation fixesSean Bright
Several various minor fixes for the readthedocs documentation.
2016-11-22cloudinit/config/cc_rh_subscription.py: Remove repos before addingBrent Baude
A user has pointed out that upon set up of a machine, users typically remove repos (sometimes all of them) and then add repos in. This does make sense for a typical user.
2016-11-22packages/redhat: fix rpm spec file.Scott Moser
Adjust the redhat spec file to fix errors found during a ./tools/brpm on centos 6: RPM build errors: File listed twice: /usr/libexec/cloud-init/uncloud-init File listed twice: /usr/libexec/cloud-init/write-ssh-key-fingerprints Installed (but unpackaged) file(s) found: /etc/NetworkManager/dispatcher.d/hook-network-manager /etc/dhcp/dhclient-exit-hooks.d/hook-dhclient
2016-11-22main: set TZ in environment if not already set.Ryan Harper
If TZ is not set in environment, then datetime.datetime() will stat /etc/localtime on every usage. datetime is used in the logging path of cloud-init, and as such this is very busy. During a normal cloud-init boot, it results in we roughly 400+ stat calls to /etc/localtime. The value we set is :/etc/localtime, which is described at https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html See also merge proposal at 307722 for more background. https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/307722
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-22disk_setup: Use sectors as unit when formatting MBR disks with sfdisk.Daniel Watkins
The version of sfdisk in wily (and onwards) only accepts sectors as a valid disk size. As such, this refactors the MBR code path in cc_disk_setup to use sectors. - use --unit=S: while newer versions of sfdisk assume --unit=S, older versions do not so we specifically pass it in. Versions of sfdisk found in supported OSes such as centos6 wont assume --unit=S. - add --force: this exists back to centos 6 (2.17.2), so it should be fine, and is what we ultimately want. "do what I say, even if it is stupid" - keep --Linux. Even though this has been deprecated for quite some time, we keep it until versions that want it are unsupported. If necessary at some point we could check for util linux version and if it had --Linux and use it in those cases. Additionally, improve usefulness of some log messages. LP: #1460715
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-15systemd: cloud-init-local use RequiresMountsFor=/var/lib/cloudScott Moser
While cloud-init writes its data to /var/lib/cloud, we previously lazily added RequiresMountsFor=/var/lib . It is more correct to list the more complete path. LP: #1642062
2016-11-15systemd: cloud-init remove After=systemd-networkd-wait-onlineScott Moser
cloud-init.service cannot currently run After=systemd-networkd-wait-online.service as systemd-networkd.service is After dbus.service, but cloud-init.service is: Before=sysinit.target and sysinit.target is before dbus.service. The result is that we are temporarily preferring for cases where there is systemd-networkd in place to have cloud-init.service run without networking properly configured. See bug 1636912 for more information.
2016-11-15systemd: cloud-init-local change Before basic to sysinitScott Moser
sysinit.target happens earlier in boot than basic.target. cloud-init-local.service had: Before=basic.target but cloud-init.service had: After=cloud-init-local.service Before=sysinit.target The result was that cloud-init-local.service was indirectly Before sysinit.target anyway, so this change is just to more specifically state that.
2016-11-10pep8: fix style errors reported by pycodestyle 2.1.0Scott Moser
pycodestyle 2.1.0 is in Ubuntu zesty, and complained about the changes made here. Simple style changes. This makes 'make pep8' pass again when built in a zesty build system with proposed enabled.
2016-11-10systemd: drop both Wants and After local-fs.targetScott Moser
Drop mention of local-fs.target from both cloud-init-local.service and cloud-init.service. This could actually could cause a loop in ordering due to cc_mounts writing mount points with: x-systemd.requires=cloud-init.service Rather, we specifically list /var/lib/ and systemd-remount-fs.service in cloud-init-local.service. cloud-init.service will run after cloud-init-local and thus will have these satisfied.
2016-11-10systemd: networking service adjustments.Scott Moser
Here we drop the Requires=networking.service but keep the After=networking.service. The change there is that we no longer force networking.service to run, as the system may not have it or be configured to use it. Second, we add After=systemd-networkd-wait-online.service. That causes us to run after systemd-networkd has brought networking up. The end result is that we now run after both ifupdown or systemd-networkd (if they were going to run) but do not force either to run. One other change is that by dropping Requires=networking.service cloud-init will now run even if networking failed to come up. LP: #1636912
2016-11-10systemd: replace Before=basic.target, dbus.target with sysinit.targetScott Moser
Per discussion on bug 1636912 and subsequent feedback on bug 1629797, using: Before=sysinit.target is a simpler solution than what we had implemented: Before=basic.target Before=dbus.target LP: #1629797
2016-11-10doc: Add documentation on stages of boot.Scott Moser
This adds long overdue documentation on stages that cloud-init runs during boot.
2016-11-10doc: make the RST files consistently formated and other improvements.Scott Moser
The biggest things here are: * move doc/sources/*/README.rst to doc/rtd/topics/datasources This gives each datasource a page in the rtd docs, which make it easier to read. * consistently use the same header style throughout. As suggested at http://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html use: # with overline, for parts * with overline, for chapters =, for sections -, for subsections ^, for subsubsections “, for paragraphs Also, move and re-format vendor-data documentation to rtd.
2016-11-09Ec2: fix syntax and tox in previous commit.Scott Moser
Simply fix a commit that should not have been pushed.
2016-11-08Ec2: protect against non-dictionary in block-device-mapping.Scott Moser
Oracle public cloud has the string 'unavailable' in its metadata service for 'block-device-mapping'. The change here is to return None in device_name_to_device if that is the case.
2016-11-08doc: fixed example to not overwrite /etc/hostsChris Glass
Instead, it will simply append the new entry.
2016-11-07Doc: fix spelling / typos in ca_certs and scripts_vendor.Scott Moser
Simple typo fixes.
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-03net/cmdline: Further adjustments to ipv6 supportLaMont Jones
The implementation to add ipv6 support to Ubuntu initramfs changed (see bug 1621507). The changes here adjust to handle the new path. Now, the ipv6 route includes using the variable 'DEVICE6' in net6-DEVICE.conf files. LP: #1621615
2016-11-03Add coverage dependency to bddeb to fix package build.Scott Moser
When we added coverage to test-requirements, we need to add the mapping to package name. Without it there, bddeb complains that it cannot translate the dependency. Note, though, that the Makefile does not invoke nose with coverage. So we don't actually use that dependency.
2016-11-01doc: improve HACKING.rst fileScott Moser
Put a bit more information and a few style fixes in HACKING.rst.
2016-11-01dmidecode: Allow dmidecode to be used on aarch64Robert Schweikert
aarch64 systems have functional dmidecode, so allow that to be used. - aarch64 has support for dmidecode as well
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-28Add coverage collection to tox unit tests.Joshua Powers
First step in increasing coverage is knowing what coverage is currently at. By default, tox only runs coverage on py3 as it is slower to run with coverage.
2016-10-25cc_users_groups: fix remaing call to ds.normalize_user_groupsRyan Harper
Previous commit f0747c4b4cf073273e11d383f0354257be7276ed relocated normalize_users_groups to ug_util module, but missed modifying the cc_users_groups config module. Apply the location change to fix.
2016-10-25disk-config: udev settle after partitioning in gpt format.Scott Moser
The function exec_mkpart_gpt was simply not waiting for udev events to flush after calling sgdisk. The corresponding function exec_mkpart_mbr already did. This should fix a transient failure where mkfs would fail with 'not a block device'. LP: #1626243
2016-10-24unittests: do not read system /etc/cloud/cloud.cfg.dScott Moser
Many of the unit tests in test_data would inadvertantly read the system's /etc/cloud/cloud.cfg and /etc/cloud/cloud.cfg.d. This was first noticed on a system deployed by MAAS, where files in /etc/cloud/cloud.cfg.d/ are root read-only. This changes those tests to actually make use of FilesystemMockingTestCase functionality and adds 'reRoot()' to that class which is easier to use for at least this use case. LP: #1635350
2016-10-20Add documentation for logging features.Wesley Wiedenmeier
Update the summary of rsyslog module and add logging.rst to docs.
2016-10-20Add support for snap create-user on Ubuntu Core images.Ryan Harper
Ubuntu Core images use the `snap create-user` to add users to an Ubuntu Core system. Add support for creating snap users by adding a key to the users dictionary. users: - name: bob snapuser: bob@bobcom.io Or via the 'snappy' dictionary: snappy: email: bob@bobcom.io Users may also create a snap user without contacting the SSO by providing a 'system-user' assertion by importing them into snapd. Additionally, Ubuntu Core systems have a read-only /etc/passwd such that the normal useradd/groupadd commands do not function without an additional flag, '--extrausers', which redirects the pwd to /var/lib/extrausers. Move the system_is_snappy() check from cc_snappy module to util for re-use and then update the Distro class to append '--extrausers' if the system is Ubuntu Core.
2016-10-19Fix sshd restarts for rhel distros.Jim Gorz
Set the default value for 'ssh_svcname' in rhel distros. This means that it no longer needs to be set in system_info config.
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-19Fix python2.6 things found running in centos 6.Scott Moser
This gets the tests running in centos 6. * ProcessExecutionError: remove setting of .message Nothing in cloud-init seems to use .message anywhere, so it does not seem necessary. The reason to change it is that on 2.6 it spits out: cloudinit/util.py:286: DeprecationWarning: BaseException.message * tox.ini: add a centos6 environment the tox versions listed here replicate a centos6 install with packages from EPEL. You will still need a python2.6 to run this env so we do not enable it by default.
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.