mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-28 22:49:00 +00:00
[PR #8098/d62fe154 backport][stable-8] inventory plugins: make data obtained from remote unsafe (#8146)
inventory plugins: make data obtained from remote unsafe (#8098)
Make data obtained from remote unsafe.
(cherry picked from commit d62fe154d2)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
baa45d044c
commit
df95f02c7b
14 changed files with 88 additions and 51 deletions
|
|
@ -97,6 +97,7 @@ except ImportError:
|
|||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.utils.unsafe_proxy import wrap_var as make_unsafe
|
||||
|
||||
from collections import namedtuple
|
||||
import os
|
||||
|
|
@ -215,6 +216,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
filter_by_label = self.get_option('filter_by_label')
|
||||
servers = self._retrieve_servers(filter_by_label)
|
||||
for server in servers:
|
||||
server = make_unsafe(server)
|
||||
hostname = server['name']
|
||||
# check for labels
|
||||
if group_by_labels and server['LABELS']:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue