iautom8things / ansible-meta-dynamic-inventory

Naming is hard. This wrapper script allows you to use set notation with dynamic host groups.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can support for comments inside the groupsfile?

dlethin opened this issue · comments

First off, this is an awesome solution. I think it's going to fit our use-cases quite nicely. Thanks for sharing.

I did run into one snag is that it seems we can't have comments in our groupsfile. For example, I have a groupsfile like this:

# comment?

and then when I run the wrapper script, I get the following:

./wrapper.sh
Traceback (most recent call last):
  File "./transformer.py", line 135, in <module>
    main(args.Groupingsfile_path)
  File "./transformer.py", line 111, in main
    parsed_groupsfile= grammer(f.read()).group_file()
  File "/usr/local/lib/python2.7/site-packages/parsley.py", line 98, in invokeRule
    raise err
ometa.runtime.ParseError:
# comment?
^
Parse error at line 1, column 0: expected the character '['. trail: [group_var_head groupvars group_file]

If I take out my comment, things work great.

Maybe I'm using the wrong character to denote a comment? Or the parsley grammar needs to be updated to support it? I don't know anything about parsley but can start to look into it.

Hey, thanks for taking a look at this! You're right, right now it does not support comments. I think that's important and I'll definitely try to add that today or tomorrow.

@dlethin please check out the latest version on master

Wow your fast. I tried it out and it appears to work great. I was going to set aside some time this week to read up on parsley and see if I could contribute a pull request. You've saved me a lot of time. Thanks again.

My pleasure! It's just great to know someone is finding this useful.