You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ec2.py inventory from devel branch on github, git commit faeccb4.
Ansible Configuration:
Nothing, I'm running ec2.py directly.
Environment:
Fedora 21 x86_64, but probably N/A.
Summary:
The ec2.py inventory's to_safe method has the logic for replace_dash_in_groups opposite of what is expected.
Currently it's this:
defto_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''regex="[^A-Za-z0-9\_"ifself.replace_dash_in_groups:
regex+="\-"returnre.sub(regex+"]", "_", word)
I think it should be this (notice the "if not"):
defto_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''regex="[^A-Za-z0-9\_"ifnotself.replace_dash_in_groups:
regex+="\-"returnre.sub(regex+"]", "_", word)
If this change is added, to maintain backwards compatibility, I think you need to default it to False like this:
# Replace dash or not in group namesifconfig.has_option('ec2', 'replace_dash_in_groups'):
self.replace_dash_in_groups=config.getboolean('ec2', 'replace_dash_in_groups')
else:
self.replace_dash_in_groups=False
Steps To Reproduce:
Add this to ec2.ini: replace_dash_in_groups = yes
Run ec2.py directly: ec2.py --refresh-cache
Notice in the output that the group name dashes have not been replaced as expected.
Change ec2.ini to this: replace_dash_in_groups = no
Run ec2.py directly: ec2.py --refresh-cache
Notice in the output that the group name dashes have unexpectedly been replaced.
Expected Results:
When I say "yes" to "replace_dash_in_groups" it should replace the dashes.
When I say "no," it should not replace the dashes.
Actual Results:
It applies the setting opposite of what is expected.
The text was updated successfully, but these errors were encountered:
Issue Type:
Ansible Version:
ec2.py inventory from devel branch on github, git commit faeccb4.
Ansible Configuration:
Nothing, I'm running ec2.py directly.
Environment:
Fedora 21 x86_64, but probably N/A.
Summary:
The ec2.py inventory's to_safe method has the logic for replace_dash_in_groups opposite of what is expected.
Currently it's this:
I think it should be this (notice the "if not"):
If this change is added, to maintain backwards compatibility, I think you need to default it to False like this:
Steps To Reproduce:
replace_dash_in_groups = yes
ec2.py --refresh-cache
replace_dash_in_groups = no
ec2.py --refresh-cache
Expected Results:
When I say "yes" to "replace_dash_in_groups" it should replace the dashes.
When I say "no," it should not replace the dashes.
Actual Results:
It applies the setting opposite of what is expected.
The text was updated successfully, but these errors were encountered: