summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceConfigDrive.py
Commit message (Collapse)AuthorAgeFilesLines
* README: Mention move of revision control to git.HEADtrunkScott Moser2016-08-101-278/+0
| | | | | | | | | | | | | | cloud-init development has moved its revision control to git. It is available at https://code.launchpad.net/cloud-init Clone with git clone https://git.launchpad.net/cloud-init or git clone git+ssh://git.launchpad.net/cloud-init For more information see https://git.launchpad.net/cloud-init/tree/HACKING.rst
* ConfigDrive: write 'injected' files and legacy networkingScott Moser2016-07-131-9/+17
| | | | | | | | | | | | | | | | | | | | | | 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.
* Just mock 'on_first_boot' vs special argumentJoshua Harlow2016-06-101-3/+2
|
* Rebase against masterJoshua Harlow2016-06-061-70/+35
|\
| * config drive conversion: recognize 'bridge' as a physical type, fix mtuScott Moser2016-06-031-2/+2
| | | | | | | | | | | | | | | | 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
| * ConfigDrive: do not use 'id' on a link for the device nameScott Moser2016-06-021-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '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.
| * re-add the 'Net' classes for datasourcesScott Moser2016-06-021-11/+14
| | | | | | | | | | | | | | | | 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'
| * config drive: log where network config came fromScott Moser2016-05-261-0/+4
| |
| * commit to push for fear of loss.Scott Moser2016-05-251-67/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | == background == DataSource Mode (dsmode) is present in many datasources in cloud-init. dsmode was originally added to cloud-init to specify when this datasource should be 'realized'. cloud-init has 4 stages of boot. a.) cloud-init --local . network is guaranteed not present. b.) cloud-init (--network). network is guaranteed present. c.) cloud-config d.) cloud-init final 'init_modules' [1] are run "as early as possible". And as such, are executed in either 'a' or 'b' based on the datasource. However, executing them means that user-data has been fully consumed. User-data and vendor-data may have '#include http://...' which then rely on the network being present. boothooks are an example of the things run in init_modules. The 'dsmode' was a way for a user to indicate that init_modules should run at 'a' (dsmode=local) or 'b' (dsmode=net) directly. Things were further confused when a datasource could provide networking configuration. Then, we needed to apply the networking config at 'a' but if the user had provided boothooks that expected networking, then the init_modules would need to be executed at 'b'. The config drive datasource hacked its way through this and applies networking if *it* detects it is a new instance. == Suggested Change == The plan is to 1. incorporate 'dsmode' into DataSource superclass 2. make all existing datasources default to network 3. apply any networking configuration from a datasource on first boot only apply_networking will always rename network devices when it runs. for bug 1579130. 4. run init_modules at cloud-init (network) time frame unless datasource is 'local'. 5. Datasources can provide a 'first_boot' method that will be called when a new instance_id is found. This will allow the config drive's write_files to be applied once. Over all, this will very much simplify things. We'll no longer have 2 sources like DataSourceNoCloud and DataSourceNoCloudNet, but would just have one source with a dsmode. == Concerns == Some things have odd reliance on dsmode. For example, OpenNebula's get_hostname uses it to determine if it should do a lookup of an ip address. == Bugs to fix here == http://pad.lv/1577982 ConfigDrive: cloud-init fails to configure network from network_data.json http://pad.lv/1579130 need to support systemd.link renaming of devices in container http://pad.lv/1577844 Drop unnecessary blocking of all net udev rules
* | Fix up tests and flake8 warningsJoshua Harlow2016-05-191-1/+0
| |
* | Work on refactoring (and adding) network conversion testsJoshua Harlow2016-05-051-122/+5
|/
* Config Drive: fix check_instance_id signature.Scott Moser2016-04-291-1/+1
| | | | | After reboot cloud-init would fail as the previously pickled object would have a check_instance_id signature but it didn't match expected
* pyflakesScott Moser2016-03-241-3/+3
|
* fix review commentsRyan Harper2016-03-241-3/+3
| | | | | | | 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.
* network_data: add link type 'phys', no need to reload json dataRyan Harper2016-03-231-4/+2
|
* fix openstack versions s/KILO/LIBERY drop networkdata read helperRyan Harper2016-03-231-1/+1
|
* configdata: parse and convert openstack network_data json to network_configRyan Harper2016-03-231-0/+137
|
* add check_instance_id to ConfigDriveScott Moser2016-03-211-0/+4
|
* Update pep8 runner and fix pep8 issuesRyan Harper2016-03-031-1/+1
|
* Largely merge lp:~harlowja/cloud-init/py2-3 albeit manually because it seemedBarry Warsaw2015-01-211-2/+2
| | | | | | to be behind trunk. `tox -e py27` passes full test suite. Now to work on replacing mocker.
* tools/run-pep8: remove leading ',' fed to --ignoreScott Moser2015-01-061-2/+2
| | | | | | | | --ignore was being called with ',E121,E...' rather than 'E121,E...'. that resulted in odd behavior, missing the pep8 errors that are fixed here.
* merge from trunkScott Moser2014-09-221-3/+11
|\
| * Openstack: Vendor data cleanupScott Moser2014-09-101-6/+7
| | | | | | | | | | | | | | | | | | | | For now, this vendor data handling is just added to openstack. However, in an effort to allow sanely handling of multi-part vendor-data that is namespaced, we add openstack.convert_vendordata_json . That basically takes whatever was loaded from vendordata and takes the 'cloud-init' key if it is a dict. This way the author can namespace cloud-init, basically telling it to ignore everything else.
| * drop version= from readersScott Moser2014-09-101-2/+2
| | | | | | | | | | | | | | | | instead of taking a version that they should look for, the readers now just select the highest supported version. definitely a use case later for having version= but nothing is using it now.
| * make BaseReader select latest supported versionScott Moser2014-09-101-10/+6
| |
| * Only use vendordata under cloud-init key for ConfigDriveJay Faulkner2014-09-101-2/+0
| | | | | | | | This data will be treated the same as vendordata from other sources.
| * Update read_config_drive to use OS_VERSIONS tuple for readersJay Faulkner2014-09-081-8/+10
| | | | | | | | | | | | | | | | | | Updated read_config_drive: removed the unused version kwarg, used the OS_VERSIONS tuple from the openstack helper to avoid hardcoding versions. Added a comment to the tuple in helpers/openstack.py asking for it to be kept in chronological order.
| * Refactor vendor_data handlingJay Faulkner2014-08-261-7/+4
| | | | | | | | | | | | vendor_data is guaranteed to be a dict if it exists; if it doesn't exist ensure it's represented by an empty dict to avoid checking it to see if it's a dict.
| * Add failback for older Openstack configdrive versionsJay Faulkner2014-08-261-1/+3
| | | | | | | | | | - Also utilizing the constants defined in cloudinit/sources/helpers/openstack.py for configdrive versions
| * Upgrade configdrive versionJay Faulkner2014-08-261-2/+14
| | | | | | | | | | | | | | - Upgrade configdrive to use 2013-10-17 - Fix issue with vendor_data.json parsing Co-Authored-By: Paul Querna <pquerna@apache.org>
* | fix: Updated some syntax to be pep8 compliantJoseph Bajin2014-08-181-3/+3
| |
* | new: Added FreeBSD support to ConfigDriveJoseph Bajin2014-08-181-2/+12
|/
* ConfigDrive: trim trailing newlines in previous-instance-idScott Moser2014-02-241-1/+1
|\ | | | | | | | | | | When cloud-init writes previous-instance-id, it does so with a trailing '\n'. This isn't ideal, as other readers also have to know that this will have a trailing '\n' on it, but here we just trim that off.
| * Ensure we strip the previous_iid file contentsJoshua Harlow2014-02-241-1/+1
|/ | | | | | The instance-id file contains the instance id and a newline, to compare correctly make sure we strip the newline before further usage.
* Capture IOError and use LOG betterJoshua Harlow2014-02-081-1/+1
|
* Remerged with trunkJoshua Harlow2014-02-071-3/+6
|\
| * Allow a Config Drive source on a partition, if the label matches.Paul Querna2014-01-091-2/+4
| |
* | Add a openstack specific datasourceJoshua Harlow2014-02-011-355/+108
|/ | | | | | | | | | | | | | | | | | | Openstack has a unique derivative datasource that is gaining usage. Previously the config drive datasource provided part of this functionality as well as the ec2 datasource, but since new functionality is being added to openstack is seems benefical to combine the used parts into one datasource just made for handling openstack deployments. This patch factors out the common logic shared between the config drive and the openstack metadata datasource and places that in a shared helper file and then creates a new openstack datasource that readers from the openstack metadata service and refactors the config drive datasource to use this common logic.
* Review adjustments.Joshua Harlow2013-09-031-7/+0
|
* Ensure data is initialized to a dict if its empty/noneJoshua Harlow2013-09-021-0/+2
|
* Add config drive support for random_seedJoshua Harlow2013-09-021-14/+35
| | | | | | | | A new field in the metadata has emerged, one that provides a way to seed the linux random generator. Add support for writing the seed and rewrite parts of the on_boot code to use a little helper class.
* support optical drives with dev node /dev/sr1Greg Padgett2013-06-041-0/+1
| | | | | | Extend a prior fix which helped discovery of media on systems using 2.6 kernels. /dev/sr0 covers only some of the use cases, /dev/sr1 is also common.
* compatibility fixes for Fedora and RHELGreg Padgett2013-03-261-0/+3
| | | | | | | | | | | | | | | | | | | | | This patch fixes issues in Fedora 18 (and upcoming RHEL 7) which are present due to their use of systemd: - store locale configuration in /etc/locale.conf - store hostname in /etc/hostname - use a symlink for /etc/localtime (prior code would set the timezone but corrupt data in /usr/share/zoneinfo due to presence of symlink) It also contains fixes for issues unrelated to systemd adoption: - explicitly scan /dev/sr0 with blkid in order to get the optical drive in the blkid cache. This prevents an issue on systems running 2.6 kernels (such as RHEL 6) in which config disks on some devices won't be detected unless the device has previously been queried. (For reference, see https://patchwork.kernel.org/patch/1770241/) - append a newline when rewriting sysconfig files, as this is customary text configuration file formatting and is expected by some parsers (such as the ifcfg-rh plugin for NetworkManager)
* merge from trunkScott Moser2013-03-071-1/+1
|\
| * DataSourceConfigDrive: consider CD rom as valid config-drive source.Scott Moser2013-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | previously, there was an attempt in the config drive source to limit the source device to a "full block device" rather than a partition. This was done by a simplistic approach of checking that the last character of the name was not a number. That was filtering out CD-rom devices (sr0). Now, we have a bit more sophisticated approach to that same problem. We filter out block devices that have a 'partition' entry in /sys/class/block/DEVICE_NAME/partition .
* | Make conf.d and the default merging use the new merging algos.Joshua Harlow2013-03-061-1/+1
| |
* | Continue working on merging code.Joshua Harlow2013-03-061-1/+3
|/
* config-drive-v2: support public keysScott Moser2012-11-121-3/+4
| | | | | | | | This does a couple things: * separates out the 'normalize_public_keys' from the DataSource's get_public_ssh_keys * uses that from config-drive datasource * supports config drive v1 or v2 public-keys * adds a test.
* REVERT revno 714: config-drive-v2: populate metadata['public-keys'] from ↵Scott Moser2012-11-121-7/+5
| | | | 'public_keys'
* config-drive-v2: populate metadata['public-keys'] from 'public_keys'Scott Moser2012-11-111-5/+7
| | | | | | | | other datasources populate 'public-keys' rather than 'public_keys' and there is a more complete handler in the base DataSource. So, to take advantage of that, have DataSourceConfigDrive copy public_keys to public-keys, and remove the 'get_public_ssh_keys' from the DataSourcEConfigDrive.