Commit Graph

1711 Commits

Author SHA1 Message Date
Stephen Finucane 868096bb52 Retire cloud-init
This appears to be an unmaintained fork of the original code, which
lives elsewhere [1]. Kill it.

[1] https://github.com/cloud-init/cloud-init

Change-Id: I1f57197f1f67aa6adce152b5e4acc63a72277c6a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2019-04-01 16:48:35 +01:00
Daniel Watkins cb1cf39109 Use a single source for version information.
Standardise on using the version given in setup.cfg.

Change-Id: I24d44fd0e3d7a5ab90ecfd2a34c8e4bb88b50ee4
2015-09-04 15:52:47 +01:00
Daniel Watkins a51119762c Configure basic logging, and make it possible to log to console.
--log-to-console will output messages at INFO and above to the
command-line.  This is super-useful when running cloud-init from a
terminal, when you don't want to have to dig in a log file.

Change-Id: Ieb3db384b73441c19ef463649c94b04ffaac8026
2015-09-04 15:40:22 +01:00
Claudiu Popa dc3efec379 Add a version filtering strategy
The current patch proposes the addition of a new data source strategy
for filtering the strategies by a given list of versions.

Each data source exports a new API, called ``version()``, which should
return the underlying version of the said data source. This implies that
each data source module can export multiple versioned data sources and it's
the duty of an external strategy to select the appropiate data source with
regard to a particular set of versions.

Change-Id: I6ef2fdd6520a53fc600232247f23bd22b848461e
2015-09-01 13:19:32 +03:00
Jenkins a6a6466035 Merge "Add an API for loading a data source" 2015-08-31 15:48:23 +00:00
Claudiu Popa 42559c7f19 Add an API for loading a data source
The patch brings a couple of new concepts into cloudinit.
We have a general miniframework for defining plugins and discovering them,
with an actual implementation which uses the *pkgutil* builtin module.

Built atop of this framework, we have a new data source loader, found
in cloudinit.bases.DataSourceLoader. The loader operates on three concepts:

  - the *module iterator*, which is used to list modules from a specific
    location (in our case, from cloudinit.sources.__path__). The data
    source loader takes care to use only the modules that exports a
    given API.

  - the data source discovery API assumes that each data source module exports
    a function called `data_sources`, which should return a tuple of data source
    classes that the said module exports. The loader filters the modules
    that provides this API.

  - the data source loader uses a new concept called *search strategy*
    for discovering a potential data source. The search strategies
    are classes whose purpose is to select one or more data sources
    from a data source stream (any iterable).
    There are multiple ways to implement a strategy, the search
    can be either serial or parallel, there's no additional requirement
    as long as they return an iterable.
    Also, the strategies can be stacked together, for instance, having
    two strategies, one for selecting only the network data sources
    and another for selecting the available data sources from a list
    of potential data sources.

This patch also adds a new API that uses the DataSourceLoader
with a given module iterator and strategies for selecting one
data source that cloudinit can use.

Change-Id: I30f312191ce40e45445ed9e3fc8a3d4651903280
2015-08-31 16:56:25 +03:00
Daniel Watkins 833dbbb28c Fix running cloud-init with no arguments on Python 3.
Change-Id: I4c1b27aa5a762fd2e9fbec7085c719060c60071c
2015-08-07 13:51:57 +01:00
Jenkins cf4f35ddac Merge "add cloud-init main" 2015-08-07 09:55:01 +00:00
Jenkins 9da7967e49 Merge "Use an explicit absolute import for importing the logging module" 2015-08-07 09:38:38 +00:00
Scott Moser fe616bf41b Add unregister and reset to DictRegistry and use
unregister allows us to unregister things, so that applying
configuration changes will affect the reporting.

Change-Id: I35932c95784060349c60a11b523bf6897fb80090
2015-08-06 18:04:43 +01:00
Claudiu Popa 62c23a29b7 Use an explicit absolute import for importing the logging module
Change-Id: Ic8a6107e202644a8a5298332712cbf2896a5e408
2015-08-06 20:03:07 +03:00
Scott Moser 735f0ac4ad add ReportingEventStack
This adds a new class ReportingEvent Stack for using
report_start_event and report_finish_event easily with a context
handler.

It also modifies FinishReportingEvent (and finish_event) accordingly
to take a status rather than simply a boolean successful.  The intent
is that WARN is provided when a non-desireable result occurred but it
is non-fatal.

Change-Id: I978c76e429790036f8740d7eb7279e925a1e74d0
2015-08-05 10:33:50 -05:00
Claudiu Popa 628e1a2fb0 Make ReportingHandler a proper base class
Having a method that raises NotImplementedError is usually not ideal,
since the implementations of the class can't delegate control
through super to the parent or to other classes found in the MRO.
Instead, we mark a priori ReportingHandler as a base class, leaving
the implementation of `publish_event` empty.

Change-Id: Id5c442b6998743b1caffbad627847ee5e88f2982
2015-08-05 14:12:22 +03:00
Scott Moser ecb7a5a389 add cloud-init main
This is start of the cloud-init main executable.

Change-Id: I795e1d279a99476fb6cd33d1e7ad6a7af0978c8d
2015-08-04 20:20:57 -05:00
Daniel Watkins 523967580a Refactor handlers out of main reporting module.
This will give us a clearer separation between the core reporting code
(which shouldn't change very often) and the handler code (which is
likely to change more often as we add new handlers and new features to
existing handlers).

It is also the first (baby) step on the path of making handlers
pluggable so third-parties can easily drop their own in.

Change-Id: I648df057d2ff719a2a81398afc80aaef9225ff5c
2015-07-31 17:13:46 +01:00
Scott Moser c8fd01e292 tests: use cloudinit.tests.TestCase everywhere
It seems sane to have consistent use of a 'TestCase' class wherever
possible.

I stumbled on need for this in porting some code (the reporter)
back to cloud-init 0.7.

Change-Id: Ia10546484dfe73154a68e817129ac2f950d5fe85
2015-07-28 16:07:37 -04:00
Jenkins a433358bbc Merge "Make reporting handlers configurable." 2015-07-28 17:53:30 +00:00
Jenkins 0be0d1dec0 Merge "Use a registry to configure reporting handlers." 2015-07-28 17:44:06 +00:00
Jenkins e82788e033 Merge "Implement a DictRegistry." 2015-07-28 17:40:55 +00:00
Jenkins e9f42d1014 Merge "improve test coverage" 2015-07-20 17:53:44 +00:00
Scott Moser 303afb7e74 improve test coverage
add some tests for safeyaml and test_url_helper

Change-Id: I3a88f52e6c02f6f1f8f31363886f6fab223c14e3
2015-07-20 11:33:19 -04:00
Daniel Watkins af671321af Make reporting handlers configurable.
And configure the LogHandler by default.

Change-Id: Ic3a1cebbe8684033fb8d46bf4baebb55a43fc890
2015-07-20 10:19:18 +01:00
Daniel Watkins b5f5a16704 Use a registry to configure reporting handlers.
Also ensure that the LogHandler is registered by default.

Change-Id: Ib9e306a0aa45ab6f5c9b543782b5dd7019b72cf1
2015-07-20 09:40:02 +01:00
Daniel Watkins 91a5942fb9 Implement a DictRegistry.
Change-Id: I67b177169285f30c7a980a51a81265c621c5f3ff
2015-07-20 09:33:54 +01:00
Daniel Watkins 4722397ef4 Convert reporting handlers to be instantiated.
This will allow us to actually have parameters passed in, which we'll
need for handlers with configuration options.

Change-Id: If105b8108d80b49b6da9e16c7520ddcee1f20c8f
2015-07-17 13:08:47 +01:00
Daniel Watkins 2856779179 Basic implementation of a reporting framework.
Change-Id: Ic468e388a4b3d66763b5db5c1b3e599f3005fa4d
2015-07-07 09:05:36 +01:00
Daniel Watkins f512e05819 Move our TestCase in to the cloudinit.tests package.
Instead of a separate cloudinit.test package.

Change-Id: I6ea05a0f57c93a944f435f306a064d918fd26152
2015-07-06 17:48:55 +01:00
Daniel Watkins a09499fc2c Don't consider version-specific code for coverage.
(Also add generated coverage reports to .gitignore)

Change-Id: Ide59ffe812d99774e9e4d0d1ad266ab665f02321
2015-07-06 17:46:10 +01:00
Daniel Watkins e10de8835b Speed up a slow test.
We had a test that was sleeping for around a second, this fudges
time.now() to make it look like it doesn't need to sleep.

Change-Id: I7f4b64ef906fcea50d88bfbf4c3f20f848b26274
2015-07-03 14:16:39 +01:00
Joshua Harlow 1479f92ab6 Expose api response properties and cache buffer decoding
Change-Id: I1e47be192eade575d2954d57991c0dd6d25e47d1
2015-07-02 21:37:32 +00:00
Jenkins 476654ce03 Merge "Bring over the 'safeyaml' from bzr" 2015-07-02 18:16:27 +00:00
Joshua Harlow 92405e6712 Bring over the 'templater' from bzr
Change-Id: Iefcceb1c0d47ae455985f1d027465b0db0a0e467
2015-07-02 17:52:51 +00:00
Joshua Harlow bf5c513472 Add importlib for python 2.6 *only*
Also fixes up a bunch of test issues that are now
being triggered on py2.6

Change-Id: I28b13ee3e1c47e2eb5266bc72c8f2da31220b99f
2015-07-02 09:41:23 -07:00
Scott Moser 792564e401 Bring over the 'safeyaml' from bzr
This will likely also be very useful to use since it
ensures we safely use/parse yaml.

Change-Id: Ibc0f7dee46d2f199e2d65d9bc6444bfa72383704
2015-06-26 11:16:19 -07:00
Claudiu Popa 6a61cf95f9 Add the data source base classes and the HTTP OpenStack implementation
Change-Id: Ia5fdbe6cbd6364f8ec671fec413fdd37741a2598
2015-06-24 19:19:13 +03:00
Jenkins 1dbb8c11fe Merge "Fail the doc build if we have any warnings." 2015-06-15 10:05:09 +00:00
Jenkins d8faf3f7a4 Merge "Change the API of wait_any_url to return a tuple of url and response" 2015-06-15 09:28:03 +00:00
Daniel Watkins 5fecfffc76 Fail the doc build if we have any warnings.
And fix existing warnings so we won't fail the doc build.

Change-Id: Idec00e3f458b4f87c2e76e4d95971ed52dd6f837
2015-06-12 18:33:11 +01:00
Claudiu Popa eeddd30116 Change the API of wait_any_url to return a tuple of url and response
Previously wait_any_url returned the first url which responded
correctly, but there was no way to actually retrieve its response.

Change-Id: I41aec4fa1f0a5007af70e787a5503ffeb539c783
2015-06-12 17:46:15 +03:00
Claudiu Popa 265eb1f7b4 Fix a faulty test
The test wasn't actually touching the branch where platform.system
is called (on Windows).

Change-Id: I47843b25f70187ee415a0dce94ba3ea1456bcdfc
2015-06-12 17:08:41 +03:00
Jenkins c68fee0eea Merge "Bring over the 'url_helper' module from bzr" 2015-06-10 18:27:18 +00:00
Joshua Harlow 911ada7bba Bring over the 'url_helper' module from bzr
This module is quite useful for fetching urls in a manner
that can be provided custom headers, retries and ssl_args
so let's ensure we have it available for usage under these
circumstances.

Also adds some basic sanity tests so that it will continue
to work as expected.

Change-Id: I4d5e777cf530e822bbea69c76846ebebb48a7927
2015-06-10 11:11:13 -07:00
Claudiu Popa e59fe5bb27 Add the layout for a couple of Windows OS utils, especially networking
This patch adds the routes implementation, general.check_os_version
and network.default_gateway, which are used by the first data source
layout.

Change-Id: If8ede3c41e834d62cfb2d341d88bc1fbaef947b6
2015-06-09 17:08:10 +03:00
Daniel Watkins be26dc7adc Add cloudinit.tests.util for shared testing code.
Starting with keeping the try/except to find mock on both Python 2 and
Python 3 in one place.

Change-Id: I4fa5e6e3f6610f6eb2601d4c3cb51d76565dd3c0
2015-06-05 18:11:50 +01:00
Scott Moser 2b4e90d8ed LICENSE: license / header redux
- 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

- also, tox.ini: work around httpretty issue

Change-Id: I259ed23767472047da823c1a67085e47afc561d8
2015-05-13 21:26:05 -04:00
Claudiu Popa afacc4881a Add the base classes for the new OS utils architecture
The base classes follows the OS utils architecture spec.

Change-Id: I1365e6c9de20dccc905e35113ccdea03f2a03f1b
2015-04-27 15:41:16 +03:00
Scott Moser cbb95af940 change license header in from GPL to Apache
This adds a standard Apache 2.0 license header where
previously was a GPLv3 license header.

As Noted in License.txt, code is still available under GPLv3.

Change-Id: I4d4f4678e014c6bfb663519c444c0d94ae96d81f
2015-04-16 10:02:04 -04:00
Scott Moser ee70dff712 initial functial tox 2015-01-21 16:21:49 -05:00
Scott Moser c81466ce76 initial tree for 2.0 work 2015-01-21 10:00:26 -05:00
Joshua Harlow e1c87425f3 Fix some whitespace issues 2014-11-30 21:35:38 -08:00