| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
|
| |
|
|
|
|
|
| |
* preserve add_host/group_by on meta: refresh_inventory
Co-authored-by: Jordan Borean <jborean93@gmail.com>
|
|
|
| |
* Add config option INVENTORY_UNPARSED_WARNING to hide the warning "No inventory was parsed, only implicit localhost is available"
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
avoid polluting vars with incorrect settings
simplify variables and templars
- variables, original, only updated with final results, reset are copies of this
- tempvars used for preliminary templating
- cvars used for connection/shell/become plugins, delegation aware
- vars_copy ignore tempvars updates and use connection plugin to get
finalized version per loop item/delegation, also used to store temp results
till we are ready to update 'variables'
- fine tune nolog just cause we are here
- also fix inventory_hostname_short for IP addresses
|
| |
|
|
|
| |
ci_complete
|
|
|
|
|
| |
* Misc typo fixes
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change:
- Fix regression: unhandled exception when given inventory directory
is empty or contains empty subdirectories.
- Fix unhandled exception when limit file is actually a directory
instead of a file.
- Fix inventory tests which previously could never fail due to missing
`set -e`. Fixed up tests that failed after `set -e` was added. Added
several tests.
Test Plan:
- New tests
- Fixed existing tests which previously could never fail
Tickets:
- Fixes #73658
Signed-off-by: Rick Elrod <rick@elrod.me>
|
|
|
|
|
|
| |
Allow constructed to optionally use vars plugin data
* mostly for those looking to leverage group_vars/ and host_vars/
* limited to already processed sources
|
|
|
|
|
| |
fixes #51025
added test cases
|
|
|
|
|
| |
* Pass the top level dictionaries to combine_vars
combine_vars uses dict.update() to replace keys
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Use InventoryManager for inventory_hostnames lookup. Fixes #17268
* Add test for using patterns
* s/it's/its/
* Allow bypassing parse_sources in InventoryManager
* Remove unneeded method call
|
|
|
|
|
| |
* return changed for group_by
* added tests and fixed 'early registeration'
|
|
|
| |
Fixes #61889
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change:
- Remove some no-op code
- Split up a somewhat complex line into two lines
- Nuke an incorrect comment
Test Plan:
CI
Signed-off-by: Rick Elrod <rick@elrod.me>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Left hand side slicing is confusing and slower but maybe more memory
efficient in some circumstances. There is one case where it adds to
code safety: when it's used to substitute a different list in place of a
slice of the original list and the original list could have been bound
to a different variable in some other code. (The most likely case of
this is when it's a global variable and some other code might import
that variable name).
Because of the confusion factor we think it should only be used for the
safety case or where it's been benchmarked and shown to have some sort
of documentatble improvement. At the moment, only one piece of code
falls into those categories so this PR removes all the other instances
of left hand side slicing.
|
|
|
|
|
|
| |
Ansible now fails with error message when user provides
non-existing limit file.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Move var plugins handling to a separate file
* Allow var plugins to require whitelisting
* Add global configuration ('demand', 'start') for users to control when they execute
* Add 'stage' configuration ('all', 'task', 'inventory') for users to control on a per-plugin basis when they execute
* Update ansible-inventory and InventoryManager to the global and stage configuration
* Update host_group_vars to use stage configuration and whitelisting
* Add documentation for using new options and to the developer's guide
* Add integration tests to exercise whitelisting and the new configuration options, using vars plugins in collections, and maintain backward compatibility
* Changelog
Co-Authored-By: Brian Coca <brian.coca+git@gmail.com>
Co-Authored-By: Sandra McCann <samccann@redhat.com>
|
|
|
|
|
|
|
|
| |
Improve tests
- add more unit test cases
- add specific integration test with more cases
Testing shows no major downside to calling .strip() twice in a comprehension vs. using a regular for loop and only calling .strip() once. Going with the comprehension for ease of maintenance and because comprehensions are optimized in CPython.
|
|
|
|
|
|
|
| |
Handle IndexError exception raised while parsing the limit file.
Fixes: #59695
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* InventoryManager start of perf improvements
* 0 not 1
* More startswith to [0] improvements
* Remove unused var
* The hash doesn't need to be a string, start as a list, make it into a tuple
* set actually appears faster than frozenset, and these don't need to be frozen
* Cache hosts lists, to avoid extra get_hosts calls, pass to get_vars too
* negligible perf improvement, it could help with memory later
* Try the fast way, fallback to the safe way
* Revert to previous logic, linting fix
* Extend pre-caching to free
* Address test failures
* Hosts are strings
* Fix unit test
* host is a string
* update test assumption
* drop SharedPluginLoaderObj, pre-create a set, instead of 2 comparisons in the list comprehension
* Dedupe code
* Change to _hosts and _hosts_all in get_vars
* Add backwards compat for strategies that don't do set host caches
* Add deprecation message to SharedPluginLoaderObj
* Remove unused SharedPluginLoaderObj import
* Update docs/comments
* Remove debugging
* Indicate what patterh_hash is
* That won't work
* Re-fix tests
* Update _set_hosts_cache to accept the play directly, use without refresh in get_hosts_remaining and get_failed_hosts for backwards compat
* Rename variable to avoid confusion
* On add_host only manipulate _hosts_cache_all
* Add warning docs around _hosts and _hosts_all args
|
|
|
| |
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
* stop ignoring merge hash behaviour in inventory
fixes #58120
* added porting note
Co-Authored-By: Alicia Cozine <879121+acozine@users.noreply.github.com>
|
|
|
|
| |
* Faster is_template
|
|
|
|
| |
"it's" == "it is"
"its" == "belonging to it"
|
| |
|
|
|
|
| |
InventoryManager's get_vars never appears to have been used (#56804)
|
|
|
|
|
|
|
|
| |
* preserve same order as inventory manager when using inventory_hostnames lookup
add a test
* move generic code
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Better test for cache method availability
fixes #54737
* try and ignore missing method
* avoid plugin cross contamination
* ammend clog
|
|
|
| |
Fix #17088
|
|
|
|
|
|
|
|
|
| |
* modify regex to use implicit charsets this should solve issues in py3 and unicode names
* fix issue with subgroups in yaml inventory
* clarify deprecation message
* separated per name warning from deprecation
* move noise to verbosity, simplify warnings
* fix docs to reflect actual 'good' practice
* change toggle to choice list to give users more options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Replace InventoryFileCacheModule with a better developer-interface
Use new interface for inventory plugins with backwards compatibility
Auto-update the backing cache-plugin if the cache has changed after parsing the inventory plugin
* Update CacheModules to use the config system and add a deprecation warning if they are being imported directly rather than using cache_loader
* Fix foreman inventory caching
* Add tests
* Add integration test to check that fact caching works normally with cache plugins using ansible.constants and inventory caching provides a helpful error for non-compatible cache plugins
* Add some developer documentation for inventory and cache plugins
* Add user documentation for inventory caching
* Add deprecation docs
* Apply suggestions from docs review
* Add changelog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* make add_group return proper name
* ensure central transform/check
* added 'silent' option to avoid spamming current users
those already using the plugins were used to the transformations, so no need to alert them
* centralized valid var names
* dont display dupes
* comment on regex
* added regex tests
ini and script will now warn about deprecation
* more complete errormsg
|
|
|
| |
Fixes #44065
|
|
|
|
| |
ansibleoptionserror should be limited to cli options
(technically --limit makes this a bit grey but hosts: should not trigger the same error)
|
|
|
|
|
|
|
|
| |
* add toggle for host pattern mismatch behaviour
fixes #40030
* fix
|
|
|
|
| |
always pass proper tb
|
|
|
|
| |
(cherry picked from commit b62693299b3d561c9a0a78c6c8e440f3c623b5d1)
|
|
|
| |
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* inventory plugins: try auto before ini
auto plugin should run before ini to avoid ini being able to parse
some plugin configuration YAML files successfully.
* Update comment
comment was added by 2ffe3c42bb15263ad67dd36842712d9d3ec99070 but
related code was later removed by
506e6a0b2d49a147e1c0c0b301c71163ea785d71.
|
|
|
| |
more precise pluing skip msg and now in higher verbosity level
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add a Singleton class, use it with Display
* update six import
* Move remaining failes to display singleton
* Fix rebase issues
* Singleton improvements
* Add code-smell for 'from __main__ import display'. ci_complete
* s/self/cls/g
* Add docs for no-main-display
* Address linting issues
* Add changelog fragment. ci_complete
* Implement reentrant lock for class instantiation in Singleton
* Add Display singleton porting guide
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* inventory now errors for invalid group/host names
also made yaml inventory slightly smarte
fixes #45493
* add some 'YAML protection' to ini plugin
* better msg
* avoid ranges as positive match
* pepe
* expand inherited instead of total override
|
|
|
|
| |
less annoying for common cases
add comment for 'tricky' conditional
|