Commit Graph

152 Commits

Author SHA1 Message Date
Darko Poljak 4c2d273f07 Unify string formatting
Use one way of string formatting: replace old `%` style with new `str.format`.

Resolve #855.
2021-03-31 08:19:34 +02:00
evilham bed08c2c5c Deal with deprecation of imp module.
importlib has been a thing since Python 3.1, and imp has been deprecated since
3.4.

Insert random complaint here about not being able to use f-strings because they
were introduced in Python 3.6 and apparently we support Python 3.5 >,<.

Output diff before to after for ./bin/cdist-build-helper test (on heavy load):
```
1,2d0
< /usr/home/evilham/s/cdist/cdist/cdist/test/__main__.py:23: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
<   import imp
72c70
< ERROR: cdisttesthost: __file/tmp/foobar requires object __file without object id. Defined at /tmp/tmp.cdist.test.g87lx7c8/tmp.cdist.test.6ramsakx
---
> ERROR: cdisttesthost: __file/tmp/foobar requires object __file without object id. Defined at /tmp/tmp.cdist.test.aqdf6vjz/tmp.cdist.test.jgv3udel
76c74
< test_nonexistent_type_requirement (cdist.test.emulator.EmulatorTestCase) ... ERROR: cdisttesthost: __file/tmp/foobar requires object __does-not-exist/some-id, but type __does-not-exist does not exist. Defined at /tmp/tmp.cdist.test.mma5j8ln/tmp.cdist.test.3zg4by4d
---
> test_nonexistent_type_requirement (cdist.test.emulator.EmulatorTestCase) ... ERROR: cdisttesthost: __file/tmp/foobar requires object __does-not-exist/some-id, but type __does-not-exist does not exist. Defined at /tmp/tmp.cdist.test.t8d6ockr/tmp.cdist.test.uimxurg9
86c84
< test_initial_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running initial manifest /tmp/tmp.cdist.test.uvid60ij/759547ff4356de6e3d9e08522b0d0807/data/conf/manifest/dump_environment
---
> test_initial_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running initial manifest /tmp/tmp.cdist.test._cttcnrj/759547ff4356de6e3d9e08522b0d0807/data/conf/manifest/dump_environment
89c87
< test_type_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running type manifest /tmp/tmp.cdist.test.k1i2onpb/759547ff4356de6e3d9e08522b0d0807/data/conf/type/__dump_environment/manifest for object __dump_environment/whatever
---
> test_type_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running type manifest /tmp/tmp.cdist.test.ukr7lrzd/759547ff4356de6e3d9e08522b0d0807/data/conf/type/__dump_environment/manifest for object __dump_environment/whatever
272c270
< Ran 225 tests in 44.457s
---
> Ran 225 tests in 43.750s
```
2020-12-06 20:24:00 +01:00
Dennis Camera 0ee3fda94d Fix paths to cdist executable 2020-11-11 15:05:04 +01:00
poljakowski 89b6215115 Clarify stdin input
Resolve #836.
2020-09-21 09:04:05 +02:00
Darko Poljak c17541f24c Expand and split by consecutive require delimiters
Resolves #832.
2020-08-24 07:16:28 +02:00
Dennis Camera ce07021580 Do not subclass object 2020-06-21 16:53:47 +02:00
Dennis Camera cdb0d2be41 Patch tests 2020-06-03 23:21:50 +02:00
Dennis Camera 747c6b1076 Respect NO_COLOR environment variable 2020-06-03 22:17:52 +02:00
evilham ba77ea9edc [UX] Add option to enable LogLevel-based coloured output.
This makes it easier for new and experienced users to run cdist with higher
verbosity levels, both to know that things are working as expected and to debug
issues.

Documentation has been modified accordingly and default behaviour is not
changed.
2020-06-01 19:11:58 +02:00
Darko Poljak da274e5ef3 Redefine/reimplement CDIST_ORDER_DEPENDENCY
CDIST_ORDER_DEPENDENCY now defines type order dependency context.
cdist (emulator) maintains global state variables, as files,
order_dep_state and typeorder_dep, and per object state variable,
as file, typeorder_dep.

If order_dep_state exists then this defines that order dependency is
turned on.
If order_dep_state does not exist then order dependency is turned off.

If order dependency is on then objects created after it is turned on are
recorded into:
    * global typeorder_dep, in case of init manifest
    * object's typeorder_dep, in case of type's manifest.

If order dependency is on then requirement is injected, where object
created before current, is read from:
    * global typeorder_dep, in case of init manifest
    * object's typeorder_dep, in case of type's manifest.

Every time order dependency is turned off, typeorder_dep files are
removed, which means that type order list is cleared, context is
cleaned.

In the end cdist cleans after itself, i.e. mentioned files are removed.

When running type manifest is finished typeorder_dep file is removed.
When running config finishes global typeorder_dep and order_dep_state
files are removed.

Global type order recording is untouched.
Furthermore, for completeness, type order is now recorded for each object
too.
2019-11-27 15:04:47 +01:00
Darko Poljak c01aa576de Add/keep empty directories 2019-11-27 14:51:28 +01:00
Darko Poljak 3cb4e76175 Allow custom message for each deprecated parameter 2019-06-20 10:54:40 +02:00
Darko Poljak 55ba49efac Add support for deprecated type parameters 2019-06-19 18:19:32 +02:00
Darko Poljak 4949af894e Add type deprecation support. 2019-05-20 18:50:25 +02:00
Darko Poljak edfaa65d2b Detect dependency cycle as soon as possible 2019-05-01 14:19:08 +02:00
Darko Poljak 51fa8af6b7 pycodestyle 2019-02-15 20:35:32 +01:00
Darko Poljak 5480c22020 Adapt object_parameters before checking conflicting parameters. 2018-10-13 16:11:51 +02:00
Darko Poljak 0b58ab8c83 Bypass Configuration singleton from other tests if any. 2018-10-10 12:34:31 +02:00
Darko Poljak 9afc17f3f8 Make cdist.test return exit code. 2018-10-10 10:37:29 +02:00
Darko Poljak 82077aff25 Add timestamping log option to config file. 2018-09-27 18:55:33 +02:00
Darko Poljak 5aa8dac80a Disable config parser interpolation 2018-06-13 07:53:52 +02:00
Darko Poljak 2dfbd89c5e Fix determining save_output_streams value through configuration 2018-03-01 20:00:54 +01:00
Darko Poljak a993e0f5a9
Support disabling saving output streams 2018-02-07 18:12:15 +01:00
Darko Poljak 9703e0f08e Save output streams.
Implementation is 99% based on Steven's initial implementation.
2018-01-09 09:31:40 +01:00
Darko Poljak e6c5563a16 NoSuchTypeError -> InvalidTypeError 2017-11-02 13:57:36 +01:00
Darko Poljak f2614469c5 configuration: converter() -> get_converter() 2017-09-11 22:36:45 +02:00
Darko Poljak f0dc21ec0c __cdist_log_level=<log level int value>; __cdist_log_level_name=<log level name> (#574) 2017-09-11 09:06:47 +02:00
Darko Poljak 1ae5b1732e Fix missing dirs cleanup. 2017-09-10 23:08:21 +02:00
Darko Poljak 519eb60664 Fix exec/{local,remote} tests. Add exec/local test to make test. 2017-09-10 22:05:05 +02:00
Darko Poljak 3454da076f Add -l/--log-level option. Honor __cdist_loglevel env var. (#572)
Add -l/--log-level option, __cdist_loglevel -> __cdist_log_level; honor __cdist_log_level env var
2017-09-09 21:17:29 +02:00
Darko Poljak f08ac264a0 pep8 2017-09-07 16:37:49 +02:00
Darko Poljak 57f15f9cce Make __cdist_loglevel value more expressive. (#571) 2017-09-07 16:36:23 +02:00
Darko Poljak 97f6517715 Configuration fixes. 2017-09-07 16:13:46 +02:00
Darko Poljak 99133219bc Add another test case. 2017-09-02 08:40:23 +02:00
Darko Poljak 5213f343c0 pep8 2017-09-01 14:11:58 +02:00
Darko Poljak 136f2ecd87 Add helpers for cdist config/install integration. (#551)
Implement simple integration API.
2017-09-01 14:08:50 +02:00
Darko Poljak bdee7273af Configfile (#559)
Add cdist configuration/config file support.
2017-08-30 23:02:17 +02:00
Darko Poljak 314a931b84 Respect cdist log level in emulator. 2017-08-12 21:40:23 +02:00
Darko Poljak 59782ad64e Fix unit test. 2017-08-11 01:20:45 +02:00
Darko Poljak 8bb70055f4 Merge branch 'master' into archiving 2017-08-10 19:11:35 +02:00
Darko Poljak ca1cc0f64a object_id = '/' is invalid 2017-08-10 19:08:44 +02:00
Darko Poljak 68cb13881f Add archiving support. 2017-08-09 16:56:02 +02:00
Darko Poljak e2a1519332 Merge inventory from beta branch. 2017-07-20 22:04:44 +02:00
Darko Poljak 126a1812a5 Fix parallel object prepare and run steps. Add nonparallel type marker. 2017-07-15 22:18:20 +02:00
Darko Poljak 2a9bd77550 Merge custom cache path pattern from beta branch. 2017-07-01 23:59:51 +02:00
Darko Poljak 609977b7ff ugly->bad 2016-12-04 20:27:42 +01:00
Darko Poljak cca6693b2e Merge install feature from 4.0-pre-not-stable. 2016-10-13 21:16:59 +02:00
Darko Poljak d49af95d3c Add warning message for faulty dependencies case. 2016-10-08 11:40:32 +02:00
Darko Poljak f858191976 Merge remote-tracking branch 'ungleich/master' into parallel-global-explorers-execution 2016-08-14 22:27:39 +02:00
Darko Poljak 5f436f21b8 Transfer and run global explorers in parallel. 2016-08-12 21:14:56 +02:00