10
10
import shlex
11
11
import logging
12
12
import traceback
13
+
13
14
from os import path
14
15
from fnmatch import fnmatch
15
16
from datetime import datetime
27
28
io_bases = IOBase
28
29
29
30
import six
31
+
30
32
from termcolor import colored
31
33
32
34
from pyinfra import logger , pseudo_inventory
33
- from pyinfra .pseudo_modules import PseudoModule
34
-
35
35
from pyinfra .api import Config , Inventory
36
36
from pyinfra .api .facts import get_fact_names , is_fact
37
37
from pyinfra .api .exceptions import PyinfraError
42
42
STDOUT_LOG_LEVELS = (logging .DEBUG , logging .INFO )
43
43
STDERR_LOG_LEVELS = (logging .WARNING , logging .ERROR , logging .CRITICAL )
44
44
45
+ ALLOWED_DATA_TYPES = tuple (
46
+ list (six .string_types ) + list (six .integer_types )
47
+ + [bool , dict , list , set , tuple , float , complex ]
48
+ )
49
+
45
50
46
51
class CliError (PyinfraError ):
47
52
pass
@@ -557,11 +562,10 @@ def make_inventory(
557
562
# Read the files locals into a dict
558
563
attrs = exec_file (data_filename , return_locals = True )
559
564
560
- # Strip out any pseudo module imports and _prefixed variables
561
565
data .update ({
562
566
key : value
563
567
for key , value in six .iteritems (attrs )
564
- if not isinstance (value , PseudoModule )
568
+ if isinstance (value , ALLOWED_DATA_TYPES )
565
569
and not key .startswith ('_' )
566
570
and key .islower ()
567
571
})
@@ -588,7 +592,6 @@ def make_inventory(
588
592
host for host in all_hosts
589
593
if (isinstance (host , tuple ) and fnmatch (host [0 ], limit ))
590
594
or (isinstance (host , six .string_types ) and fnmatch (host , limit ))
591
-
592
595
]
593
596
594
597
# Reassign the ALL group w/limit
0 commit comments