Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible-config dedupe ini plugin entries
added test for ini file integrity, also ensuring no dupes
- Loading branch information
Showing
6 changed files
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- ansible-config init will now dedupe ini entries from plugins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
shippable/posix/group5 | ||
context/controller |
10 changes: 10 additions & 0 deletions
10
test/integration/targets/ansible-config/files/ini_dupes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python | ||
|
||
import configparser | ||
import sys | ||
|
||
|
||
ini_file = sys.argv[1] | ||
print(ini_file) | ||
c = configparser.ConfigParser(strict=True, inline_comment_prefixes=(';',)) | ||
c.read_file(open(ini_file)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- name: test ansible-config for valid output and no dupes | ||
block: | ||
- name: Create temporary file | ||
tempfile: | ||
path: '{{output_dir}}' | ||
state: file | ||
suffix: temp.ini | ||
register: ini_tempfile | ||
|
||
- name: run config full dump | ||
shell: ansible-config init -t all > {{ini_tempfile.path}} | ||
|
||
- name: run ini tester | ||
shell: "{{ansible_playbook_python}} '{{role_path}}/files/ini_dupes.py' '{{ini_tempfile.path}}'" | ||
ignore_errors: true | ||
register: test_ini | ||
|
||
- name: check results | ||
assert: | ||
that: | ||
- test_ini is success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters