summaryrefslogtreecommitdiff
path: root/cloudinit
AgeCommit message (Collapse)Author
2016-05-12Fix up a ton of flake8 issuesJoshua Harlow
2016-05-06fix timestamp in reporting events.Scott Moser
If no timestamp was passed into a ReportingEvent, then the default was used. That default was 'time.time()' which was evaluated once only at import time.
2016-04-29Paths: fix instance path if datasource's id has a '/'.Scott Moser
If the datasource's instance id contained a '/' then the instance_id path would not be as expected under /var/lib/cloud/instances/instance_id. LP: #1575938
2016-04-29Config Drive: fix check_instance_id signature.Scott Moser
After reboot cloud-init would fail as the previously pickled object would have a check_instance_id signature but it didn't match expected LP: #1575055
2016-04-28Tweak instance path name based on review feedbackRobert Jennings
r1213 (Ensure instance path is a child of cloud_dir) stripped the leading path separator. This patch goes further by replacing all path seperators with '_' which will avoid a deep directory structure under /var/lib/cloud/instances. LP: #1575938
2016-04-28cloudstack: Only use DHCPv4 lease files as a datasourceWido den Hollander
It could be that there are also 'dhclient6.leases' files in /var/lib/dhcp when DHCPv6 is used next to DHCPv4. This patch makes sure we only read from DHCPv4 lease files
2016-04-27Ensure instance path is a child of cloud_dirRobert Jennings
A cloud has an instance-id metadata value in the form: /Compute-$TENANT/$CLOUDUSERNAME/$UUID The leading '/' causes /var/lib/cloud/instance to link to /Compute-$TENANT/$CLOUDUSERNAME/$UUID rather than /var/lib/cloud/instances/Compute-$TENANT/$CLOUDUSERNAME/$UUID This patch strips the leading path separator from the instance-id. LP: #1575938
2016-04-15network: do not write interface as 'auto' from ip= on command line.Scott Moser
When ip= on the kernel command line defines the networking, set those network devices to be manually controlled, instead of 'auto'. The reason for this is that if they're marked as 'auto': a.) a second attempt will be made to ifup them. b.) they'll be brought down on shutdown 'b' is problematic on network root filesystem. Also this picks up 2 changes from curtin's net module: - Cleanup newline logic so we always have a clean '\n\n' between stanza - Add a unittest to validate bonding network config render, specifically when to emit auto $iface for dependent bond slaves. LP: #1568637
2016-04-15write 'allow-hotplug', but 'auto' for auto.Scott Moser
2016-04-15support and render control=manual on initramfs network devicesScott Moser
when reading the initramfs configurewd devices and turning them into network config, we change to not have 'auto' control (or allow=auto). The reason for this is that if the device was still up: a.) it would try to bring it up again (due to bug 1570142) b.) it would be brought down. 'b' is problematic if there is an iscsi or network root filesystem. Note, that ifupdown does now support 'no-auto-down' which means that the nic should not be brought down on 'ifdown -a'. LP: #1568637
2016-04-15sync with curtin on render_interfacesScott Moser
This picks up newline cleanup and some bond fixes from curtin at rev 374. - Cleanup newline logic so we always have a clean '\n\n' between stanza - Add a unittest to validate bonding network config render, specifically when to emit auto $iface for dependent bond slaves.
2016-04-15only apply networking once per instanceScott Moser
This attempts to only apply the networking once per instance by doing so only if the datasource was restored from disk. This will work by default for datasources with a functioning check_instance_id or if the user has set manual_cache_clean to true.
2016-04-15networking: no longer delete eth0.cfg on debian/ubuntuScott Moser
Ubuntu cloud images in created a file during build that would interfere with cloud-init's discovered or rendered networking. To avoid the issues, cloud-init was deleting /etc/network/interfaces.d/eth0.cfg . The build process no longer creates this file. However, to address any existing files cloud-init will still remove the file if it has known content and warn otherwise. LP: #1563487
2016-04-14fallback net config: do not consider devices starting with 'veth'Scott Moser
Just skip devices that are named veth*. The fix here is to ignore lxd created devices, but any other veth device that is created at this point in boot is probably not the right interface to dhcp on. LP: #1569064
2016-04-13phone_home: allow usage of fqdnScott Moser
This simply allows the phone_home template to pass the systems fully qualified domain name. LP: #1566824
2016-04-13chef: straighten out validation_cert and validation_keyScott Moser
Now, validation_key is always a path to a file, as it is in chef's client.rb syntax. validation_cert is always the *content* of that file that should be written. However, if validation_cert is the string "system", then we do not write that value, but rather assume the file exists. LP: #1568940
2016-04-13skip bridges when generating fallback networkingScott Moser
It does not make sense to consider bridges when searching for fallback networking. If the system is configured with a bridge, then its probably for some purpose other than to get to a metadata service. Considering the bridge could make cloud-init pick the wrong device on reboot. LP: #1569974
2016-04-12rh_subscription: only check subscription if configuredScott Moser
The rh_subscription config module would attempt to connect to the RHN servers even when no config is provided. Now, instead check to make sure that valid config is provided first. That consists of username and password or a activation key. LP: #1536706
2016-04-12SmartOS, CloudSigma: fix error when dmi data is not availbleScott Moser
In Cloudsigma, the datasource would warn if no product id was availble. SmartOS would log exception. This fixes both of those, changing the warning to a debug message. LP: #1569469
2016-04-12DataSourceNoCloud: fix check_instance_id when upgradedScott Moser
A system that had booted, upgraded, and then rebooted would show a cloud-init stack trace as it attempted to run new code with the old pickled object. The old object would not have the seed_dirs attribute. So we check and fallback correctly if that is not present. LP: #1568150
2016-04-12provide a warning if 'system' but file does not existScott Moser
2016-04-12chef: straighten out validation_cert and validation_keyScott Moser
Now, validation_key is always a path to a file, as it is in chef's client.rb syntax. validation_cert is always the *content* of that file that should be written. However, if validation_cert is the string "system", then we do not write that value, but rather assume the file exists. LP: #1568940
2016-04-11minor cleanupsScott Moser
- use util.del_file rather than os.remove - raise exception if debconf-communicate is not present - add a trailing newline into debconf-communicate input
2016-04-11lxd-bridge: Don't require a bridge name and implement support for domain nameStéphane Graber
2016-04-11Update lxd-bridge code to do a single debconf-communicate run and split ↵Stéphane Graber
debconf logic to a function
2016-04-11Add support for lxd-bridge configurationStéphane Graber
2016-04-06Ensure that a resolve conf object is written as a string.Scott Moser
Instead of passing the raw object and expecting the write_file to work automatically make sure we explicitly pass the string version of it so that the write_file routine can correctly encode/decode it as needed. LP: #1479988
2016-04-06fix tests and hopefully actually workScott Moser
2016-04-06rh_subscription: only check subscription if configuredScott Moser
The rh_subscription config module would attempt to connect to the RHN servers even when no config is provided. Now, instead check to make sure that valid config is provided first. That consists of username and password or a activation key. LP: #1536706
2016-04-06fix adding of users when no group is specifiedScott Moser
revision 1179 regressed adding a user that did not have a 'groups' entry present in cloud-config. This handles that correctly, making 'add_user' able to take: a.) groups="group1,group2" b.) groups=["group1", "group2"] c.) groups=None d.) no groups parameter Additionally, if a primary group is specified it will also be created. End result is that this is functional: #cloud-config groups: ["sudo"] users: - name: sysop primary-group: sysop groups: "sudo,adm" shell: /bin/bash - name: user1 primary-group: users groups: sudo - name: foo1 - name: bar gecos: Bar groups: ["bargroup"] Resulting in: $ groups sysop sysop : sysop adm sudo $ groups user1 user1 : users sudo $ groups foo1 foo1 : foo1 $ groups bar bar : bar bargroup LP: #1562918
2016-04-06support adding the primary group alsoScott Moser
2016-04-05write_files: fix decompression of contentScott Moser
When provided with gzipped data, an exception would be raised because of a conversion to string. This fixes the issue and adds a test for write_files. LP: #1565638
2016-04-04chef: fix chef installation from gemsScott Moser
Installation from gems was previously always broken. This fixes the order or parameters calling install_chef_from_gems. LP: #1553345
2016-04-04disk_setup: correctly send --force to mkfs on block devicesScott Moser
Send the --force flag to mkfs or other filesystems when target is a block device. This fixes a general code flow issue where we were setting the --force flag. LP: #1548772
2016-04-04DataSource: set ds_cfg to be a dictionaryScott Moser
if the Datasource does not have an entry in config, then set it to be a empty dictionary rather than None. Also remove places that did this elsewhere.
2016-04-04merge with trunkScott Moser
2016-03-30fix adding of users without a groupScott Moser
revision 1179 regressed adding a user that did not have a 'groups' entry present. This should handle that correctly, making 'add_user' able to take: a.) groups="group1,group2" b.) groups=["group1", "group2"] c.) groups=None d.) no groups parameter LP: #1562918
2016-03-29Misc fixes for VMware Support.Scott Moser
- Modified the code to look for customization specification file in /var/run/vmware-imc/ directory instead of /tmp - Fixed the 'seed file' issue. There was a regression in DataSourceOVF.py file. Fixed it.
2016-03-29 Added a comment about /var/run/vmware-imc directory.Sankar Tanguturi
2016-03-29apply_network_config improvementsScott Moser
3 things here: a.) do not raise exception, only warn when trying to apply a network config for a distro that does not have an implementation. This is important since debian/ubuntu is the only one *with* an implementation at the moment b.) apply network config in 'cloud-init --local' even if there is no datasource found. c.) do not write 70-persistent-net.rules the code was writing both 70-persistent-net.rules and /etc/systemd/network/50-cloud-init-*.link files that would just be confusing.
2016-03-24pyflakesScott Moser
2016-03-24some final changesScott Moser
a.) do not write systemd link files if we do not have a mac address. the check is updated to check for value rather than just presense (ie, 'mac_address': None) b.) DataSourceNoCloudNet: search in the nocloud seed dir this is important because NoCloud if dsmode is Net will look only would pass by, expecting NoCloudNet to pick it up but NoCloudNet would not look in /var/lib/cloud/seed/nocloud and thus skip it. c.) support the disabling of network configuration via /var/lib/cloud/data/upgraded-network This is what the package upgrader is writing.
2016-03-24pep8 fixes from last comment mergeScott Moser
2016-03-24support reading network config from kernel command lineScott Moser
This adds support for suppling network configuration on the kernel command line in 2 ways: a.) kernel command line includes 'network-config=<base64>' value of that parameter is base64 encoded json (or yaml) it is taken as network config yaml. In order to save space on kernel command line, it can be base64 encoded gzipped json also. b.) ip= paired with files authored by klibc's ipconfig tool When network devices are brought up in the initramfs, klibc's ipconfig tool writes files are named /run/net-<DEVNAME>.conf. The best documentation available on that tool is /usr/share/doc/libklibc/README.ipconfig.gz. Also changes util.get_cmdline() to return the command line of pid 1 if it is in a container. That is to make it consistent with The systemd generator, and allow passing a command line to lxd, as lxd does not mask /proc/cmdline.
2016-03-24add comments and improve error messagesScott Moser
2016-03-24make get_cmdline read /proc/1/cmdline if inside a containerScott Moser
This follows behavior of systemd/cloud-init-generator. This way you can feed a command line into lxc container.
2016-03-24ConfigDrive: convert OpenStack network_data.json to network_config.yamlScott Moser
OpenStack clouds may provide network_data.json information via the MetadataService in ConfigDrive. Teach ConfigDrive to read, store and convert the data into network_config yaml format. Making this available allows cloud-init to read network config from OpenStack and use the distro.apply_network_config() method to render the network_config from OpenStack into a distro network configuration file.
2016-03-24fix review commentsRyan Harper
net: add render_route comment to document why we added || true to route statements DataSourceConfigDrive: Only convert network_json to network_config when caller reads network_config attr. Cache the conversion.
2016-03-24remove debug codeScott Moser
2016-03-24provide datasource.check_instance_id with access to system configScott Moser
Changing this interface to allow for easy change later. The thing that this will enable is: a.) maas datasource to look at the system config and see if it is configured with the same consumer_key b.) datasource config could allow setting a variable that it would look at.