Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix converting group of hosts #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ini2yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ for section in config.sections():
if len(group) == 1: # section contains host group
for name, value in config.items(section):
if value:
value = name + '=' + value
delimiter = ':' if name.find('[') else '=' # adding a group of hosts e.g. web[1:5].example.com
value = name + delimiter + value
else:
value = name
host = re.split(' |\t', value, 1)
Expand Down
1 change: 1 addition & 0 deletions tests/inventory.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ group_colons_unquoted_string=x::

[local]
localhost host_boolean=True host_int=42 host_quoted_string='Hello, World!' host_double_quoted_string='Hello, World!' host_unquoted_string=abc host_colon_quoted_string='x::' host_colon_double_quoted_string='x::' host_colons_unquoted_string=x::
web[1:3].ecample.com