summaryrefslogtreecommitdiff
path: root/cloudinit
AgeCommit message (Collapse)Author
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-15move 'main' into cloudinit/cmd/ for easier testingScott Moser
This moves bin/cloud-init's content into cloudinit/cmd/main.py, and then fixes the pep8/flake8 issues with that. The end result is easier testing of main.
2016-06-15merge with trunkScott Moser
2016-06-15fis some Datasourcenocloud issuesScott Moser
LP: #1592505
2016-06-15Silence pep8 warnings due to patcher activationJoshua Harlow
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-14Don't continue running with no actionJoshua Harlow
2016-06-14Retain the prior attribute missing handlingJoshua Harlow
2016-06-14Make the bin/cloud-init an actual console entrypointJoshua Harlow
This allows for the test_cli test to be more sane.
2016-06-14fix pep8 failure introduced in recent commit.Scott Moser
The commit 1232 (Refactor a large part of the networking code) broke pep8.
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-10Fix the broken import and 'parse_net_config_data' function usageJoshua Harlow
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-10Fix apt configure unittests to run in more environmentsScott Moser
As well as some improvements that were found along testing them and due to the fact that we review some of that code again in the scope of curtin currently. Tests: - add a test for an alternate keyserver - harden mirrorfail tests to detect and skip if no network is available - improve apt_source related tests to work on CentOS7 Changes: - gpg key handling is now in python instead of a shell blob and moved to its own module. - packages/bddeb has an option to sign as someone else than smoser - make exception handling of apt_source features more specific (do not catch broad 'Exception') - rename some functions to reflect better what they actually do - capture some helper subp calls output to avoid spilling into stdout when not intended
2016-06-10minor changes prior to mergeScott Moser
a.) remove 'gpg_' from function names in new gpg module. b.) use --recv-keys rather than --recv --recv-keys is more obvious and works back to precise at least. c.) do not trim trailing '\n' from a armour'd key.
2016-06-10Change missing Cheetah log warning to debug [Andrew Jorgensen]Scott Moser
In the absence of cheetah, which is a fairly heavy templating engine, and not strictly needed by anything in cloud-init, the only warning we saw in the logs was this one from the templater. Degrading this to a debug message makes any other warnings more relevant.
2016-06-09improve error handling and reporting in gpg functionsChristian Ehrhardt
2016-06-09move gpg functions into gpg.pyChristian Ehrhardt
This helps for cleaner code structuring. ALong that makeing sure all these functions have a gpg_prefix.
2016-06-07system config of networking should override datasource providedScott Moser
while datasource provided networking is more dynamic in most cases, preference should still be given to networking configuration provided in the system. This is because the user of the image should be ultimately in control of the networking configuration if they so choose. LP: #1590104
2016-06-07For now just remove compat.py moduleJoshua Harlow
Let's reduce the size of this change for now.
2016-06-06Get cmdline working againJoshua Harlow
2016-06-06Rebase against masterJoshua Harlow
2016-06-06Change the Cheetah warning to a debug messageAndrew Jorgensen
In the absence of cheetah, which is a fairly heavy templating engine, and not strictly needed by anything in cloud-init, the only warning we saw in the logs was this one from the templater. Degrading this to a debug message makes any other warnings more relevant.
2016-06-06capture output of gpg calls to avoid messing up stdout/stderrChristian Ehrhardt
2016-06-06rename fucntion to mirrorurl_to_apt_fileprefix to reflect what it actually doesChristian Ehrhardt
2016-06-06rename add_key / add_source to add_apt_key / add_apt_sourceChristian Ehrhardt
The functions clearly are apt specific so the name should reflect that.
2016-06-06fixup key tests for cases where network isn't availableChristian Ehrhardt
2016-06-06add_key_raw - make exceptions more specificChristian Ehrhardt
2016-06-06pythonify getkeybyid and move it to uitl.pyChristian Ehrhardt
2016-06-03improve network configurationScott Moser
This branch accomplishes several things: - centrally handle 'dsmode' to be 'local' or 'net. This allows local data sources to run before networking but still have user-data read by default when networking is available. - support networking information being read on dreamcompute dreamcompute's openstack declares networking via the /etc/network/interfaces style 'network_config' format. - support reading and applying networking information on SmartOS - improve reading networking from openstack network_data.json (LP: #1577982) add support for mtu and routes and many miscellaneous fixes. - support for renaming devices in a container (LP: #1579130). Also rename network devices as instructed by the host on every boot where cloud-init networking is enabled. This is required because a.) containers do not get systemd.link files applied as they do not have udev. b.) if the initramfs is out of date then we need to apply them. - remove blocking of udev rules (LP: #1577844, LP: #1571761) LP: #1577982, #1579130, #1577844, #1571761
2016-06-03fix tox -e flake8Scott Moser
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-03fix issue with routes on subnets not getting renderedScott Moser
2016-06-03avoid rendering 'lo' twice by not writing it in network config.Scott Moser
2016-06-03lxd: fix log messsageScott 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-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-02eni parsing: support 'ether' in hwaddress, netmask and broadcastScott Moser
this adds ability to support ENI that has: hwadress ether 36:4c:e1:3b:14:31 or hwaddress 36:4c:e1:3b:14:31 the former is written by openstack (at least on dreamhost). Also, in the conversion of eni to network config support broadcast and netmask.
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-02fix log message in emit_upstartScott Moser
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-06-01clean up log message a bit.Scott Moser
2016-06-01cloudinit/stages.py: if no datasource found, do not attempt is_new_instanceScott Moser
if local does not find a datasource, then we try to apply networking. but that would then hit the NULL_DATA_SOURCE which does not work with is_new_instance. avoid that.
2016-06-01support renaming and fix logic in rename_interfacesScott Moser
The one issue i'm aware of currently is that tap devices (ip tuntap add mode tap user root mytap1) do not work correctly with 'is_up' which means the check does not bring them down and the rename fails. The LOG.debug message should be cleaned up too, as it currently references the function rather function.__name__ for nicer message.