File extensions are not a requirement #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there! Thank you for making this awesome library!
Trying to use it on our ansible inventories and group_vars structure led to some weird results where I could not parse any of our group_vars properly.
I found that in the library there is a hard requirement on having group_var files with extensions:
aini/vars.go
Lines 110 to 112 in b67a1e9
Current ansible use case
Here is an example structure that works fine with ansible:
Ansible
[core 2.17.6]
does not have any issue with the file naming:ainidump
(from commitb67a1e990856ac488c888cab9bfcda9fe62015df
) output on the same inventory/group_vars files (notice lack of group_vars):Open Question / Discussion
If we don't care about the file extension, when we parse what we expect to be the vars from a YAML format, and we get an error from
yaml.Unmarshal
:aini/vars.go
Lines 118 to 121 in b67a1e9
We kinda have to ignore it, or maybe print out warnings?
With the current test coverage at least, because it has
junk_file.txt
, we can't actually return an error here, or we never end up reading thesome_vars.yml
file.How would you want to better handle this in tests?
I realize its not a great idea to ignore parsing errors here, but I question why there is even a
junk_file.txt
to begin with, as ansible should just ignore it too.Minor deprecation changes
ioutil.ReadFile
is deprecated useos.ReadFile
instead