Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37708084
en ru br
ALT Linux repositórios
S:2.9.27-alt3

Group :: Sistema/Configurações/Rede
RPM: ansible

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: ansible_native_concat-use-to_text-rather-than-jinja2.patch
Download


>From 550e021cd2628a6460ed32395297ffed38074396 Mon Sep 17 00:00:00 2001
From: Martin Krizek <martin.krizek@gmail.com>
Date: Tue, 24 Mar 2020 12:03:31 +0100
Subject: [PATCH] ansible_native_concat: use to_text rather than jinja2's
 text_type (#68038)
jinja2._compat.text_type has been removed in jinja2's master branch so
use ansible's to_text instead.
---
 ...le_native_concat-use-to_text-rather-than-text_type.yml | 2 ++
 lib/ansible/template/native_helpers.py                    | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
 create mode 100644 changelogs/fragments/ansible_native_concat-use-to_text-rather-than-text_type.yml
diff --git a/changelogs/fragments/ansible_native_concat-use-to_text-rather-than-text_type.yml b/changelogs/fragments/ansible_native_concat-use-to_text-rather-than-text_type.yml
new file mode 100644
index 0000000000..fd8a612e60
--- /dev/null
+++ b/changelogs/fragments/ansible_native_concat-use-to_text-rather-than-text_type.yml
@@ -0,0 +1,2 @@
+minor_changes:
+  - ansible_native_concat() - use ``to_text`` function rather than Jinja2's ``text_type`` which has been removed in Jinja2 master branch.
diff --git a/lib/ansible/template/native_helpers.py b/lib/ansible/template/native_helpers.py
index 11c14b7fa1..e0df87dcb0 100644
--- a/lib/ansible/template/native_helpers.py
+++ b/lib/ansible/template/native_helpers.py
@@ -10,9 +10,9 @@ from ast import literal_eval
 from itertools import islice, chain
 import types
 
-from jinja2._compat import text_type
-
 from jinja2.runtime import StrictUndefined
+
+from ansible.module_utils._text import to_text
 from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
 
 
@@ -46,7 +46,7 @@ def ansible_native_concat(nodes):
             # (see Jinja2 source of StrictUndefined to get up to date info)
             # Otherwise the undefined error would be raised on the next access which might not be properly handled.
             # See https://github.com/ansible/ansible/issues/52158
-            # We do that only here because it is taken care of by text_type() in the else block below already.
+            # We do that only here because it is taken care of by to_text() in the else block below already.
             str(out)
 
         # short circuit literal_eval when possible
@@ -57,7 +57,7 @@ def ansible_native_concat(nodes):
             nodes = chain(head, nodes)
         # Stringifying the nodes is important as it takes care of
         # StrictUndefined by side-effect - by raising an exception.
-        out = u''.join([text_type(v) for v in nodes])
+        out = u''.join([to_text(v) for v in nodes])
 
     try:
         return literal_eval(out)
-- 
2.29.3
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009