summaryrefslogtreecommitdiff
path: root/cloudinit/sources/__init__.py
AgeCommit message (Collapse)Author
2013-09-10fix DataSource base class to set up ds_cfg for 'Net' sourcesScott Moser
When the base DataSource class would set 'ds_cfg' for the specific datasources' config, it would fail for the DataSources that are just named 'DataSourceFooNet' and we wanted to set configuration in 'Foo'. For example, both DataSourceOpenNebula and DataSourceOpenNebulaNet want to read datasource config from sources: OpenNebula: foo: bar But without this change, 'ds_cfg' would not be setup properly for OpenNebulaNet.
2013-09-10Fix pylint complain on toks.split('.')Vlastimil Holer
2013-09-05Merged trunk lp:cloud-initVlastimil Holer
2013-07-23alias 'availability_zone' to availability-zone in metadata service.Scott Moser
The place this was noticed was in trying to use the 'nova.clouds.archive.ubuntu.com' mirror selection. Because the config-drive-v2 has a metadata entry of 'availability_zone', it didn't get found by the availabilty_zone property in cloudinit/sources/__init__.py LP: #1190431
2013-03-06Continue working on merging code.Joshua Harlow
2012-12-19Remove conflicting merge blockVlastimil Holer
2012-12-19Merged trunk lp:cloud-initVlastimil Holer
2012-11-12config-drive-v2: support public keysScott Moser
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. LP: #1077700
2012-10-27Helpful cleanups.harlowja
1. Remove the usage of the path.join function now that all code should be going through the util file methods (and they can be mocked out as needed). 2. Adjust all occurences of the above join function to either not use it or replace it with the standard os.path.join (which can also be mocked out as needed) 3. Fix pylint from complaining about the tests folder 'helpers.py' not being found 4. Add a pylintrc file that is used instead of the options hidden in the 'run_pylint' tool.
2012-10-05Ensure that config drive datasource attempts toJoshua Harlow
translate the device name to a actual device using logic that will try the ec2 metadata (if avail) or will try using 'blkid' to find a corresponding label. LP: #1062540
2012-09-24fix make pep8Scott Moser
2012-09-20Initialize toks variable. Fix EC2-like hostname generation based on IPv4.Vlastimil Holer
2012-09-19Optionally resolve IPv4 hostname.Vlastimil Holer
2012-09-14Fix hostname derived from IP. (LP: 1050962)Andy Grimm
2012-08-27For the userdata 'post-filtering' add in a new folder thatJoshua Harlow
can contain filters that serve this purpose only and add in the initial launch-index filter and replace the code in the datasource class that previously did this.
2012-08-27Update so that the content types searched for launch-indexJoshua Harlow
variable has a little more meaning and by default look in metadata for 'launch-index' and have ec2 instead look for a different variable (thus allowing more datasources to just work).
2012-08-26Fix tests running and add in a check on the content typeJoshua Harlow
before we look into the payload as well as make the skip test a function that the datasource module can also use.
2012-08-26Don't use the processed userdata if nothing is there.Joshua Harlow
2012-08-26Add the capability to understand and filter onJoshua Harlow
userdata based on a launch-index (or leave userdata alone if none is provided by the datasource). This works by doing the following. 1. Adjusting the userdata processor to attempt to inject a "Launch-Index" header into the messages headers (by either taking a header that already exists or by looking into the payload to see if it exists there). 2. Adjust the get_userdata ds function to apply a filter on the returned userdata (defaulting to false) that will now use the datasources get_launch_index value to restrict the 'final' message used in consuming user data (the same behavior if not existent). 3. Further down the line processes that use the 'resultant' userdata now will only see the ones for there own launch index (ie cloud-config will be restricted automatically and so on) and are unaffected (although they can now ask the cloud object or the datasource for its launch index via the above new ds method.
2012-08-22return results from datasource.get_package_mirror_infoScott Moser
2012-08-22rework package mirror selectionScott Moser
There are several changes here. * Datasource now has a 'availability_zone' getter. * get_package_mirror_info * Datasource convenience 'get_package_mirror_info' that calls the configured distro, and passes it the availability-zone * distro has a get_package_mirror_info method * get_package_mirror_info returns a dict that of name:mirror this is to facilitate use of 'security' and 'primary' archive. * this supports searching based on templates. Any template that references undefined values is skipped. These templates can contain 'availability_zone' (LP: #1037727) * distro's mirrors can be arch specific (LP: #1028501) * rename_apt_lists supports the "mirror_info" rather than single mirror * generate_sources_list supports mirror_info, and as a result, the ubuntu mirrors reference '$security' rather than security (LP: #1006963) * remove the DataSourceEc2 specific mirror selection, but instead rely on the above filtering, and the fact that 'ec2_region' is only defined if the availability_zone looks like a ec2 az.
2012-08-19Add a 'none' datasource as a last resort fallbackJoshua Harlow
1. This will allow a basically empty datasource to be activated (as the last datasource) when no other datasources work. This allows modules to still run (if they can, new function added to the datasource if modules want to check if cloud-init is in this 'disconnected' state).
2012-06-211. Move all info() logging methods to debug() harlowja
2. Adjust comment on sources list from depends 3. For the /etc/timezone 'writing', add a header that says created by cloud-init
2012-06-201. Add an importer function that will search for a given module in a set of ↵Joshua Harlow
search module 'prefixes' that also has a potential set of required attributes. 2. Use this new importer to find the distro class, the userdata handler modules, the config modules and the datasource modules, if none can be found error out accordingly.
2012-06-20Change to import error instead of runtime error.Joshua Harlow
2012-06-19Fix pylint line length issues.Joshua Harlow
2012-06-19Cleanup no datasource exception to use cleaner csv list.Joshua Harlow
2012-06-19Cleanup some of the logging (its a little to verbose).Joshua Harlow
2012-06-181. Fixed datasource construction (switched param order)Joshua Harlow
2. Fixed up importing of modules to handle the failure case better a. Also realized that using the import class we don't have to reimport a module via getattr, so removed that.
2012-06-16Allow the user data processor to be passed in.Joshua Harlow
This could and should be useful for unit testing.
2012-06-16For the different base classes, ensure we are using the 'abc' module + ↵Joshua Harlow
appropriate annotations + metaclasses.
2012-06-16Adjust the usage of map items() to iteritems() which will help later ↵Joshua Harlow
translation to python 3.
2012-06-15Fixups to ensure that pylint does not find anything major wrong.Joshua Harlow
2012-06-15Complete initial cleanup for refactoring/rework.Joshua Harlow
Some of the cleanups were the following 1. Using standard (logged) utility functions for sub process work, writing, reading files, and other file system/operating system options 2. Having distrobutions impelement there own subclasses to handle system specifics (if applicable) 3. Having a cloud wrapper that provides just the functionality we want to expose (cloud.py) 4. Using a path class instead of globals for all cloud init paths (it is configured via config) 5. Removal of as much shared global state as possible (there should be none, minus a set of constants) 6. Other various cleanups that remove transforms/handlers/modules from reading/writing/chmoding there own files. a. They should be using util functions to take advantage of the logging that is now enabled in those util functions (very useful for debugging) 7. Urls being read and checked from a single module that serves this and only this purpose (+1 for code organization) 8. Updates to log whenever a transform decides not to run 9. Ensure whenever a exception is thrown (and possibly captured) that the util.logexc function is called a. For debugging, tracing this is important to not just drop them on the floor. 10. Code shuffling into utils.py where it makes sense (and where it could serve a benefit for other code now or in the future)
2012-06-11Add more logging in onto what is being searched for.Joshua Harlow
2012-06-09Initial cleanupsJoshua Harlow
2012-06-08Remove is ipv4 function from here and move to utils + move exceptions to ↵Joshua Harlow
here as well as other find datasource function.
2012-06-071. Move cloud init and cloud config objects to a cloud file.Joshua Harlow
2. Cleanup main __init__ file with shell additions, constants usage, os.path usage.
2012-06-07Darn it. Those shouldn't be there!Joshua Harlow