Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
3865c505
Commit
3865c505
authored
May 26, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11058 from srvg/bug/11017
limit extensions for files in group/host_vars dir
parents
c87586e9
b92d70c5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
2 deletions
+21
-2
lib/ansible/utils/__init__.py
+3
-1
test/units/TestInventory.py
+6
-1
test/units/inventory_test_data/group_vars/noparse/all.yml~
+2
-0
test/units/inventory_test_data/group_vars/noparse/file.txt
+2
-0
test/units/inventory_test_data/group_vars/parse/all.yml
+2
-0
test/units/inventory_test_data/simple_hosts
+6
-0
No files found.
lib/ansible/utils/__init__.py
View file @
3865c505
...
...
@@ -1617,7 +1617,9 @@ def _load_vars_from_folder(folder_path, results, vault_password=None):
names
.
sort
()
# do not parse hidden files or dirs, e.g. .svn/
paths
=
[
os
.
path
.
join
(
folder_path
,
name
)
for
name
in
names
if
not
name
.
startswith
(
'.'
)]
paths
=
[
os
.
path
.
join
(
folder_path
,
name
)
for
name
in
names
if
not
name
.
startswith
(
'.'
)
and
os
.
path
.
splitext
(
name
)[
1
]
in
C
.
YAML_FILENAME_EXTENSIONS
]
for
path
in
paths
:
_found
,
results
=
_load_vars_from_path
(
path
,
results
,
vault_password
=
vault_password
)
return
results
...
...
test/units/TestInventory.py
View file @
3865c505
...
...
@@ -56,7 +56,7 @@ class TestInventory(unittest.TestCase):
'thrudgelmir0'
,
'thrudgelmir1'
,
'thrudgelmir2'
,
'thrudgelmir3'
,
'thrudgelmir4'
,
'thrudgelmir5'
,
'Hotep-a'
,
'Hotep-b'
,
'Hotep-c'
,
'BastC'
,
'BastD'
,
'neptun'
,
]
'BastC'
,
'BastD'
,
'neptun'
,
'goldorak'
,
]
#####################################
### Empty inventory format tests
...
...
@@ -222,6 +222,11 @@ class TestInventory(unittest.TestCase):
inventory
.
subset
(
'@'
+
os
.
path
.
join
(
self
.
test_dir
,
'restrict_pattern'
))
self
.
assertEqual
(
sorted
(
inventory
.
list_hosts
()),
sorted
([
'thor'
,
'odin'
]))
def
test_vars_yaml_extension
(
self
):
inventory
=
self
.
simple_inventory
()
vars
=
inventory
.
get_variables
(
'goldorak'
)
assert
vars
[
'YAML_FILENAME_EXTENSIONS_TEST'
]
@raises
(
errors
.
AnsibleError
)
def
testinvalid_entry
(
self
):
Inventory
(
'1234'
)
...
...
test/units/inventory_test_data/group_vars/noparse/all.yml~
0 → 100644
View file @
3865c505
---
YAML_FILENAME_EXTENSIONS_TEST: False
test/units/inventory_test_data/group_vars/noparse/file.txt
0 → 100644
View file @
3865c505
---
YAML_FILENAME_EXTENSIONS_TEST: False
test/units/inventory_test_data/group_vars/parse/all.yml
0 → 100644
View file @
3865c505
---
YAML_FILENAME_EXTENSIONS_TEST
:
True
test/units/inventory_test_data/simple_hosts
View file @
3865c505
...
...
@@ -20,3 +20,9 @@ Bast[C:D]
[auth]
neptun auth="YWRtaW46YWRtaW4="
[parse:children]
noparse
[noparse]
goldorak
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment