Commit Graph
28 Commits
Author SHA1 Message Date
Matt ClayandGitHub d37cec2ea8 Spelling and grammar fixes (#86417) 2026-01-13 11:34:56 -08:00
Matt ClayandGitHub 6ff6339191 Ensure config env/ini values are tagged (#85404)
* Ensure config env/ini values are tagged

Config env and ini values now have origin and trust tags applied.

* Remove unused import
2025-06-30 16:33:37 -07:00
9a426fe303 fix ensure_type to support vaulted values (#85129)
* restored parity with 2.18

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-10 05:05:56 +00:00
d33bedc48f Misc config type coercion fixes (#85119)
* remove dead config comment noise

* update `list` typed config defaults to be lists

* fix tag preservation/propagation in config
* numerous other ensure_type bugfixes
* 100% unit test coverage of ensure_type
* emit warnings on template_default failures
* fix unhandled exception in convert_bool on unhashable inputs

Co-authored-by: Matt Clay <matt@mystile.com>

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-08 13:06:18 -07:00
35750ed321 Templating overhaul, implement Data Tagging (#84621)
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-04-14 08:54:36 -07:00
snipfooandGitHub 5f4e332e37 Fix condition for unquoting configuration strings from ini files (#82388)
* Add prefix to `origin` when configuration variables come from ini files

Fixes ansible#82387

This change was suggested by @bcoca in
https://github.com/ansible/ansible/pull/82388#discussion_r1424235728 and
https://github.com/ansible/ansible/pull/82388#discussion_r1424249732

When configuration variables come from an ini file, their `origin` is
now set to `ini: <file>`. Similarly, once supported, YAML configuration
files will have their `origin` as `yaml: <file>`.

Consequently, since unquoting configuration strings should happen if and
only if they come from an ini file, this condition boils down to testing
whether their `origin` starts with `ini:`.

* Do not add prefix to `origin` but explicitly pass `origin_ftype`

So as not to rely on a specific format of the `origin` string,
as suggested by @sivel in
https://github.com/ansible/ansible/pull/82388#issuecomment-1881714871
2024-03-26 09:12:17 -05:00
Matt Clay 5b1b0ce762 Remove Python 2 compat (via six) from unit tests 2023-11-01 17:05:36 -07:00
Matt ClayandGitHub 9f899f9492 Require from __future__ import annotations (#81902) 2023-10-04 22:11:17 +00:00
371b62eab1 Add test for 256-color configuration values (#78613)
* Add test for 256-color configuration values

See #78607.

* color is not restricted to 16 choices

 currently supports up to 256, not listing them all
 TOOD: create examples and point to/list the basic 16

---------

Co-authored-by: Brian Coca <brian.coca+git@gmail.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2023-07-19 15:46:47 -04:00
Matt ClayandGitHub 5f58775a1f More unit test code coverage improvements (#81136) 2023-06-27 17:38:35 -07:00
Matt ClayandGitHub 2cd1744be3 Use ansible.module_utils.common.text.converters (#80704)
Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
2023-05-03 08:58:00 -07:00
Miklos SagiandGitHub b7ef2c1589 ansible-playbook -K breaks when passwords have quotes (#79837)
Now only 'unquote' when ini config file is the source
2023-02-20 11:58:21 -05:00
Matt ClayandGitHub 25d859f8fb Clean up unused imports in unit tests (#79893) 2023-02-02 15:52:38 -08:00
Brian CocaandGitHub abdd237de7 Yolo (#77554)
* Revert "Revert "Config, ensure templating happens at functions (#77483)""

This reverts commit 94c9106153.

* removed update configdata, which is unused
* removed test for action we don't perform anymore
* removed unused configdata
2022-04-18 15:57:00 -04:00
Matt MartzandGitHub f8ef34672b Provide better decryption errors for single vault values (#72362)
Fixes #72276
Fixes #72281
2020-11-18 14:25:32 -06:00
Rick ElrodandGitHub 3b40c6f3b7 [config] coerce more to string when 'type: str' (#72172)
Change:
- When a plugin defines `type: str` on a parameter, treat more kinds of
  input as a string instead of whatever it is parsed as.

Test Plan:
- New unit tests
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-10-14 12:53:08 -04:00
Matt Clay 98a0995fd0 Clean up unit test boilerplate. 2020-06-22 14:20:33 -07:00
Sloane HertelandGitHub 8eb00dd14c Fix inline vaults for plugins in ensure_type (#67492)
* Fix implicit string - only looked right because of the vault __repr__
* Add tests for strings and implicit strings
2020-02-25 10:42:31 -05:00
Jordan BoreanandGitHub 7092c196ed config manager str type vault source (#65023)
* config manager str type vault source

* Convert vault text to_text earlier and add tests
2019-11-20 12:02:28 +10:00
Brian CocaandGitHub a39b721db5 fixes to config manager (#58530)
* skip unreadable ansible.cfg

* all types should check for type

* patch access for tests and fix tests that relied on missing files not being checked
2019-07-17 10:39:30 -04:00
Matt ClayandGitHub 465df0ef8d Fix encoding issues with file paths. (#50830)
* Fix encoding issues with file paths.

Discovered while testing with ANSIBLE_CONFIG env var set to a path
that contained unicode characters while LC_ALL=C.

* Fix unit tests.

* Fix another path encoding issue.
2019-01-14 13:06:47 -08:00
Abhijeet KasurdeandToshio Kuratomi 139e3477a7 Review comments
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-18 12:20:35 -08:00
Abhijeet KasurdeandToshio Kuratomi 44bd8fc0a8 Update unit tests for configmanager
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-18 12:20:35 -08:00
Matt ClayandGitHub 3033fd96b0 Move unit test compat code out of lib/ansible/. (#46996)
* Move ansible.compat.tests to test/units/compat/.
* Fix unit test references to ansible.compat.tests.
* Move builtins compat to separate file.
* Fix classification of test/units/compat/ dir.
2018-10-12 20:01:14 -07:00
Toshio Kuratomi f46c943d3d Fix another corner case of too many warnings for world readable current working directory
There should be no warning if there is no ansible.cfg file i nthe
current working directory.
2018-08-23 20:23:59 -07:00
Toshio KuratomiandGitHub 30662bedad Only print warning when ansible.cfg is actually skipped (#43583)
Only print warning when ansible.cfg is actually skipped

* Also add unittests for the find_ini_config_file function
* Add documentation on world writable current working directory
  config files can no longer be loaded from a world writable current
  working directory but the end user is allowed to specify that
  explicitly.  Give appropriate warnings and information on how.

Fixes #42388
2018-08-03 10:39:33 -07:00
Brian CocaandBrian Coca 386515281e additional configmanager tests
left placeholders for more
2017-10-13 20:25:12 -04:00
Brian CocaandBrian Coca 12c8dd1893 config tests
also a couple of fixes to manager
2017-10-12 19:26:39 -04:00