summaryrefslogtreecommitdiff
path: root/cloudinit/handlers/__init__.py
AgeCommit message (Collapse)Author
2022-02-10Shell script handlers by freq (#1166)Chris Lalos
Handlers for per-boot/per-instance/per-once multipart MIME Add handlers for adding scripts to userdata that can be run at various frequencies. Scripts of type x-shellscript-per-boot, x-shellscript-per-instance, or x-shellscript-per-once can be added to a multipart MIME userdata message as part of instance userdata. These scripts will then be added to the appropriate per-boot, per-instance, or per-once directory in /var/lib/cloud/scripts/ during processing of userdata.
2021-12-15Adopt Black and isort (SC-700) (#1157)James Falcon
Applied Black and isort, fixed any linting issues, updated tox.ini and CI.
2020-01-21Start removing dependency on six (#178)Daniel Watkins
* url_helper: drop six * url_helper: sort imports * log: drop six * log: sort imports * handlers/__init__: drop six * handlers/__init__: sort imports * user_data: drop six * user_data: sort imports * sources/__init__: drop six * sources/__init__: sort imports * DataSourceOVF: drop six * DataSourceOVF: sort imports * sources/helpers/openstack: drop six * sources/helpers/openstack: sort imports * mergers/m_str: drop six This also allowed simplification of the logic, as we will never encounter a non-string text type. * type_utils: drop six * mergers/m_dict: drop six * mergers/m_list: drop six * cmd/query: drop six * mergers/__init__: drop six * net/cmdline: drop six * reporting/handlers: drop six * reporting/handlers: sort imports
2018-09-11user-data: jinja template to render instance-data.json in cloud-configChad Smith
Allow users to provide '## template: jinja' as the first line or their #cloud-config or custom script user-data parts. When this header exists, the cloud-config or script will be rendered as a jinja template. All instance metadata keys and values present in /run/cloud-init/instance-data.json will be available as jinja variables for the template. This means any cloud-config module or script can reference any standardized instance data in templates and scripts. Additionally, any standardized instance-data.json keys scoped below a '<v#>' key will be promoted as a top-level key for ease of reference in templates. This means that '{{ local_hostname }}' is the same as using the latest '{{ v#.local_hostname }}'. Since instance-data is written to /run/cloud-init/instance-data.json, make sure it is persisted across reboots when the cached datasource opject is reloaded. LP: #1791781
2017-04-21pylint: fix all logging warningsJoshua Powers
This will change all instances of LOG.warn to LOG.warning as warn is now a deprecated method. It will also make sure any logging uses lazy logging by passing string format arguments as function parameters.
2016-12-22LICENSE: Allow dual licensing GPL-3 or Apache 2.0Jon Grimm
This has been a recurring ask and we had initially just made the change to the cloud-init 2.0 codebase. As the current thinking is we'll just continue to enhance the current codebase, its desirable to relicense to match what we'd intended as part of the 2.0 plan here. - put a brief description of license in LICENSE file - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0 - simplify the per-file header to reference LICENSE - tox: ignore H102 (Apache License Header check) Add license header to files that ship. Reformat headers, make sure everything has vi: at end of file. Non-shipping files do not need the copyright header, but at the moment tests/ have it.
2016-05-12Fix up a ton of flake8 issuesJoshua Harlow
2015-04-16fix cloud-config-archive handlingScott Moser
handling of cloud-config-archive input would fail in fully_decoded_payload. part.get_charset() would return a Charset object, but get_charset.input_codec is a string suitable for passing to decode. This handles that correctly, and is more careful about binary data inside input. The test added verifies that cloud-config inside a cloud-config-archive is handled correctly and also that binary data there is ignored without exceptions raised. LP: #1445143
2015-04-16pep8 fixesScott Moser
2015-03-11userdata-handlers: python3-related fixes on do-not-process-this-part pathOleg Strikov
Cloud-init crashed when received multipart userdata object with 'application/octet-stream' part or some other 'application/*' part except archived ones (x-gzip and friends). These parts are not processed by cloud-init and result only in a message in the log. We used some non-python3-friendly techniques while generating this log message which was a reason for the crash.
2015-01-27Respond to review:Barry Warsaw
- Refactor "fully" decoding the payload of a text/* part. In Python 3, decode=True only means to decode according to Content-Transfer-Encoding, not according to any charset in the Content-Type header. So do that.
2015-01-26Fix a few string/bytes problems with Python 3.Barry Warsaw
2015-01-21Largely merge lp:~harlowja/cloud-init/py2-3 albeit manually because it seemedBarry Warsaw
to be behind trunk. `tox -e py27` passes full test suite. Now to work on replacing mocker.
2014-01-16simplify consume_vendordata, move exclusion, consume_vendordata per instanceScott Moser
this simplifies consume_vendordata a bit, changes consume_vendordata to be by default "PER_INSTANCE" (like userdata). The other thing we do here is move the exlusion to be handled when walking the data. The benefit of doing it then is that we can exclude part-handlers. Without the ability to exlude part handlers, exclusion is basically useless (since part-handlers could accomplish anything they wanted).
2013-07-24change 'json-patch' to 'cloud-config-jsonp'Scott Moser
2013-07-24merge from trunkScott Moser
2013-07-21Just use an initialized array.Joshua Harlow
2013-07-20Remove return not used.Joshua Harlow
2013-07-20Also handle custom handlers correctly.Joshua Harlow
LP: #1203368
2013-07-20Add usage of '#json-patch'Joshua Harlow
2013-06-19fix and cleanup usage of util.logexcJuerg Haefliger
2013-03-06Continue working on merging code.Joshua Harlow
2013-03-05Add in a bunch of changes and tests.Joshua Harlow
2012-11-22Continue working on merging prototype.Joshua Harlow
2012-11-20Start allowing different merging types to be appliedJoshua Harlow
After user data handling splits apart all the different content types into there various mime messages it is nice to be able to have each message specify how it should be merged (mainly for cloud-config or cloud-archive) into the single cloud config that is eventually used. This starts to add a plugable merging framework and the needed components to activate said headers and merging.
2012-11-06Do the append after escape.Joshua Harlow
2012-11-06Use a method instead + at leastJoshua Harlow
attempt the unicode-escape path.
2012-11-06Fix the case where a unknown type is seen andJoshua Harlow
it has contents which are in unicode which seems to cause python to blow-up when this happens since 'string-escape' doesn't work on unicode (at least in 2.6). LP: #1075756
2012-08-22fix pep8 complaints.Scott Moser
make pep8 now is silent on precise's pep8 ( 0.6.1-2ubuntu2).
2012-07-12walker_callback: fix traceback on empty payload.Scott Moser
A previous commit of mine here tried to apply a trivial fix to avoid a warning on empty content type. Instead, it made the empty content type call a handler which did not exist. This instead logs warning on unknown non-empty payload. It logs debug on empty payload.
2012-06-29[merge-from-trunk] remove warning message to console on empty user-dataScott Moser
2012-06-211. Only register and increment the handler count after we have ensured it ↵Joshua Harlow
imports and call_begin passes. 2. Fixup the 'test__init__.py' file to now be working again.
2012-06-21Remove a unused import.Joshua Harlow
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-20Massive pylint + pep8 fixups!Joshua Harlow
2012-06-17Log handler + info that is about to be calledJoshua Harlow
2012-06-161. Allow for checking against lower case include types.Joshua Harlow
2. Perform lstrip on the payload, just incase people put spaces/whitespace before the type.
2012-06-16Update error messaging for when importing/registring a part-handler failsJoshua Harlow
2012-06-161. Ensure a that when a bad version is found, that it gets set to 1.Joshua Harlow
2. Increment part handler count even if it doesn't get registered (this shouldn't cause any problems)
2012-06-16When a handler version is set but to an unknown non-int convertable value, ↵Joshua Harlow
treat it as 1
2012-06-16They are handlers not mods ;)Joshua Harlow
2012-06-16Make the top level __init__ similar to the other top level __inits__ where ↵Joshua Harlow
just util functions and base classes are defined there.
2012-06-15Ensure that this directory is treated as a module.Joshua Harlow
2012-06-15Moved the handlers from a user_data directory to a handler directory.Joshua Harlow
2012-06-11Removing distro specifics from here, as well as running functionality (which ↵Joshua Harlow
is now elsewhere).
2012-06-08Move how handler module names are found to here as well as a fixup module ↵Joshua Harlow
function for bad modules.
2012-06-08Remove cloud config from here and move to cloud.pyJoshua Harlow
2012-06-071. Adding some new helper files that split off file inclusion, templating, ↵Joshua Harlow
importing, constant usage. 1. Move all datasources to a new sources directory 1. Rename some files to be more consistent with python file/module naming.