Rather than adding further complexity to the regex, preprocess the output to
remove any empty lines. Now the only purpose of the regex is to fix
wrapped lines.
Fixes#70949
(cherry picked from commit 51f2f1ac5e)
Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
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
(cherry picked from commit 3980eb8c09)
* use same timeout for galaxy api interactions (#77088)
Also, bump the default. A number of people have reported problems with
this 20 second timeout for a couple of years on
https://github.com/ansible/galaxy/issues/2302
It is mentioned in the issue that resolving dns can sometimes take up to
30 seconds, and that this timeout includes dns resolution.
Includes a changelog message
* fix type hint
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
* Fix collection redirects for filter and test plugins (#77210)
* Fix collection redirects for jinja2 filters/tests
* Handle recursive redirects
Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 8063643b4c)
* The error message is only capitalized on 2.13. Make test more flexible.
(cherry picked from commit 734777ef05)
* Fix 'ansible-galaxy collection verify' to report files/directories not listed in the FILES.json
(cherry picked from commit a1d467dbb2)
* changelog
(cherry picked from commit 3d49d6f69e)
* [stable-2.11] Use full python package for ansiballz cache filenames (#77090)
* Use full python package for ansiballz cache filenames
* Be a little more explicit about test goals
(cherry picked from commit 8cbe143)
Co-authored-by: Matt Martz <matt@sivel.net>
* linting
This works around issues on RHEL 7.9 when an old version of pexpect is installed from an OS package.
(cherry picked from commit 27fe26edbf)
Co-authored-by: Matt Clay <matt@mystile.com>
Installation of MarkupSafe 2.1.0 and later require setuptools 39.2 or later,
or a recent version of pip which supports installation using a wheel.
Some systems will not have new enough versions of pip and/or setuptools,
especially virtual environments -- including those created by ansible-test.
ssh plugin, use 'correct' information source in all cases
* still fallback to pc
* added inventory to new test
* undef var can still show as parser error on pc
now task_exectuer has a more accurate error handling
(cherry picked from commit be19863e44)
needed to properly propagate some arguments by convention: subset, filter
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
(cherry picked from commit 5bddecb048)
* updated tests to conform to new block inheritance
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
(cherry picked from commit b1d6750e8b)
* [stable-2.11] ansible-test - Use relative paths in junit output. (#76871)
* ansible-test - Use relative paths in junit output.
* ansible-test - Handle out-of-tree JUnit paths.
* Also fix a traceback in the junit callback during automatic fact gathering.
(cherry picked from commit fbb5d56bd2)
* Fix task path unicode error in junit callback.
(cherry picked from commit 41db6d8d35)