Commit Graph

31924 Commits (201aba3d0f6801471a3f9ef66eff2b7cc0d77b97)

Author SHA1 Message Date
Brian Coca 4706091a38
rename systemd module to services only (#77644)
* rename systemd module to services only

 disambiguates what it handles since systemd is now much more
 that a service manager, but the module is specific to services
2 years ago
Joseph Torcasso c9ce7d08a2
template/__init__.py - fix KeyError when wantlist=False with non-list 2 years ago
Brian Coca 5e50284693
Restrict role loading .. to role ... (#77683)
* Ansible will now error out if you try to use the `*_from` to load files from outside the role being loaded by `{import,include}_role`
2 years ago
Martin Krizek e9af6efee6
Raise a proper error when include/import_role is used as a handler (#77807) 2 years ago
Mark Chappell cb448097e4
Minor typo fix (#77804) 2 years ago
Brian Coca 0d6aa2e87e
More information on doc parsing errors (#77685)
* More information on doc parsing errors

  fixes #77675
2 years ago
Abhijeet Kasurde 524d30b8b0
distribution: add distribution_minor_version for Debian Distro (#74721)
* Added a fact about minor version details for Debian Distro

Fixes: #74481

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2 years ago
Brian Coca 46d2c9a988
document some 'dir' based filters (#77687)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
Co-authored-by: Emmanuel Ugwu <32464178+ugwutotheeshoes@users.noreply.github.com>
2 years ago
Tabah Baridule 18fe5a8835
Updated text in ini.py (#77746) 2 years ago
Matt Clay cc5ac88c4c Update mypy test. Fix type hints for Python 3.9.
This also bumps the minimum controller version (for mypy only) to Python 3.9.
2 years ago
Martin Krizek dbdbfe845a
Remove deprecated subclassing DefaultCallback without doc_fragment (#77677) 2 years ago
Brian Coca a12e0a0e87
ansible-config added json/yaml output to list/dump (#77447)
fixes #733644
2 years ago
Brian Coca a3cc6a581e
dont rely on path to set config defs for plugins (#77659) 2 years ago
Brian Coca fb2f080b42
document base64 filters (#77657)
* document base64 filters

* Update lib/ansible/plugins/filter/b64decode.yml

Co-authored-by: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/filter/b64encode.yml

Co-authored-by: Sandra McCann <samccann@redhat.com>

Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Martin Krizek ec00c9c64e
Deprecate FACT_PATH/GATHER_SUBSET/GATHER_TIMEOUT defaults (#77656) 2 years ago
Martin Krizek ed30fc9a06
Remove deprecated loading cache plugins directly without cache_loader (#77655) 2 years ago
Brian Coca 749a105956
ansible-doc stay 3.8 python compatible (#77682)
pathlib with_stem will wait till 3.9
  also add tests by listing filters
2 years ago
Matt Clay f7c2b1986c Require blocking IO for ansible CLI. 2 years ago
Brian Coca b439e41a91
expand ansible-doc coverage (#74963)
* Expand ansible-doc to tests/filters and fix existing issues

  enable filter/test docs if in single file or companion yaml
  add docs for several filters/tests plugins
  allow .yml companion for docs for other plugins, must be colocated
  verify plugins are valid (not modules, cannot)
  fix 'per collection' filtering
  limit old style deprecation (_ prefix) to builtin/legacy
  start move to pathlib for saner path handling
  moved some funcitons, kept backwards compat shims with deprecation notice

  Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
  Co-authored-by: Felix Fontein <felix@fontein.de>
  Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Sandra McCann d321fa3f15
remove import_play examples from include module (#77597) 2 years ago
Brian Coca af9f628ab5
Add python path to version output (#77631)
To further disambiguate 'which' python is the correct python
2 years ago
Martin Krizek 3980eb8c09
Prevent losing unsafe from lookups (#77609)
* Prevent losing unsafe from lookups

This patch fixes a bug which under certain conditions results in data
returned from lookups not being marked as unsafe.

Each time Templar.do_template is invoked a new AnsibleContext is
created and stored effectively at two places:
1) as an instance variable in templar_obj.cur_context
2) as a local variable called new_context in do_template method of Templar

Due to custom functionality in Ansible's Context that allows for nested
templating it is possible that during resolving variable's value
template/do_template method is called recursively again, again creating
a new context. At that point the problem manifests itself because as
mentioned in 1) above the context is overwriten on the templar object
which means that any subsequent calls to _lookup will use the new
context to mark it as unsafe which is now different to the local
new_context which is used for testing for unsafe property.

The solution to the problem appears to be to restore the original
context inside do_template and also to eliminate the local variable
new_context to prevent problems in the future.

It appears that we don't have a better way of storing the context other
than as some form of global variable and so this appears to be the
"best" solution possible at this point. Hopefully data tagging will be
the solution here.

For more examples see unit and integration tests included in this patch.

Fixes #77535
2 years ago
Matt Clay 6fdec4a6ab Revert "Require blocking IO for ansible CLI. (#77639)"
This reverts commit e2d54d3594.
2 years ago
Matt Clay e2d54d3594
Require blocking IO for ansible CLI. (#77639) 2 years ago
Sandra McCann 1802684c7b
add link to deprecation warning (#77599)
* add link to deprecation warning

(cherry picked from commit f991470dd0)
2 years ago
code-review-doctor 578a815271
Fix issue probably-meant-fstring found at https://codereview.doctor (#77619) 2 years ago
Brian Coca d06d99cbb6
git fix docs and wrapper script (#77588)
* git fix docs and wrapper script

 fixes #77582

 now env var is set to wrapper or full command depending on version
 as was the intent of previous PR
 added ref to git commit from git for why/how we used the env vars

* handle key_file
2 years ago
Sam Doran 1b947eaf92
arg_spec - Return aliases in validation result and update aliases (#77576)
When looking up the `no_log` setting for a parameter that is an alias in
`AnsibleModule._log_invocation()`, the alias value will always be an
empty dictionary since `self.aliases` on the `AnsibleModule` instance is
never updated after initialization. Since the `no_log` setting is on the
canonical parameter not the alias, an incorrect warning is issued if the
parameter matches `PASSWORD_MATCH`.

This PR returns the aliases dictionary as an attribute of the
`ValidationResult` and updates the `aliases` attribute on the
`AnsibleModule` instance.
2 years ago
Sloane Hertel 494f932773
Deprecate PlayContext.verbosity (#77507)
display.verbosity should be used instead
2 years ago
Brian Coca 2c2a204dc6
varaiblemanager, more efficienet vars file reads (#77570) 2 years ago
Jack 4d69c09695
ansible-galaxy collection - ensure dependencies are a dict (#77561)
* fix traceback when installing collection with dependencies set to None
2 years ago
Sloane Hertel 9280396e19
Fix error message for non-str hosts in yaml inventory (#77544) 2 years ago
Brian Coca 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
2 years ago
Matt Clay 94c9106153 Revert "Config, ensure templating happens at functions (#77483)"
This reverts commit 6e5f1d781d.
2 years ago
Brian Coca 762d97f1b8
setup: remove 'any' as seemingly valid option (#77532)
fixes #59783
2 years ago
Junegunn Choi 2ba39fcf8c
Update pip example with standard lowercase http[s]_proxy env vars (#77515) 2 years ago
Martin Krizek cbe42bff7f
Allow for lazy evaluation of Jinja2 expressions (#56116) 2 years ago
Brian Coca f2ab920822
Better info sourcing (#77511)
Task is  authoritative
   also includes latest per loop info
   and fix tests
2 years ago
Brian Coca 793bb200ec
CLI now issues clearer error when 0 hosts selected (#77517)
fixes #77512
2 years ago
Brian Coca 6e5f1d781d
Config, ensure templating happens at functions (#77483)
move away from special templating in constants.py
 simplified main get, unified paths to get info

* Let native jinja deal with eval for type
* make constants available for templating defaults
* ensure we use config file
2 years ago
Will Thames c3a3bc1d0d
Allow strftime to display time in UTC (#70351) 2 years ago
Brian Coca a0dede5458
ansible-connection verboistery (#77509)
* ansible-connection verboistery

  for cli, just use normal parser creation
 this also adds --help, but that seems fine
 also some error cleanup

Co-authored-by: Nathaniel Case <this.is@nathanielca.se>
2 years ago
Brian Coca 3b9592fcaf
Move to display as single source of verbosity (#77498)
* Move to display as single source of verbosity

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Matt Clay 32d67ce998 Exclude Python 2.6 from interpreter discovery. 2 years ago
htol d7fbde4ea9
Make "~/.ansible" path configurable (#76114)
* replace hardcoded '~/.ansible' to C.ANSIBLE_HOME
* rename previously existing env ANSIBLE_HOME in env-setup script
* modify cache dir monkeypatching in galaxy api unit tests
* update "version_added" to 2.14 for ANSIBLE_HOME
* fix description of collections with proper use of ANSIBLE_HOME

Co-authored-by: htol <github@h-tol.net>
Co-authored-by: stefanwascoding <stefan@syntaxhelden.de>
2 years ago
Corubba 94138cf608
template override colon bugfixes (#77495)
* Proper error on missing jinja2 override separator

Properly catch the case when no (or a wrong) separator is used in a
jinja2 override, and return a useful error message to the user.

* Support colons in jinja2 override value

By limiting the split to 1, any colons in the value are preserved and
passed on.
2 years ago
Martin Krizek 94eff70030
PlayIterator - remove deprecated states (#77444) 2 years ago
Sloane Hertel 477c55b0d2
Get git executable for collections in git repos (#77493)
* Fix traceback installing collections from git repos if git is not installed
2 years ago
Martin Krizek a85261342a
template module: document jinja2_native behavior (#77445) 2 years ago
Martin Krizek c7e198b907
Ensure correct environment_class is set on Template (#77485) 2 years ago