mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-21 09:51:27 -07:00
[stable-6] inventory plugins: make data obtained from remote unsafe (#8147)
inventory plugins: make data obtained from remote unsafe (#8098)
Make data obtained from remote unsafe.
(cherry picked from commit d62fe154d2
)
This commit is contained in:
parent
12df7f7a95
commit
d250bb5217
14 changed files with 83 additions and 46 deletions
|
@ -121,6 +121,7 @@ from ansible.errors import AnsibleParserError
|
|||
from ansible.module_utils.common.text.converters import to_native, to_text
|
||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
||||
from ansible.module_utils.common.process import get_bin_path
|
||||
from ansible.utils.unsafe_proxy import wrap_var as make_unsafe
|
||||
|
||||
|
||||
class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
|
@ -138,6 +139,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
strict = self.get_option('strict')
|
||||
|
||||
for host in hosts:
|
||||
host = make_unsafe(host)
|
||||
hostname = host['name']
|
||||
self.inventory.add_host(hostname)
|
||||
for var, value in host.items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue