ansible_spec cannot use ec2.py dynamic inventory
philbert opened this issue · 3 comments
philbert commented
The ec2.py dynamic inventory returns a json object with structure like:
{
"_meta": {
"hostvars": {
"some_key1": {
"ec2_something_something": false,
...
},
"some_key2": {
"ec2_something_something": true,
...
}
...
}
},
"tag_some_other_key1": [
"host-1",
"host-2"
],
"some_other_key2": [
"host-1"
],
...
}
Resulting in the get_dynamic_inventory method to fail with this error:
TypeError: no implicit conversion of String into Integer
/Users/Phil/.rvm/gems/ruby-2.0.0-p643/gems/ansible_spec-0.2.1/lib/ansible_spec/load_ansible.rb:95:in `[]'
/Users/Phil/.rvm/gems/ruby-2.0.0-p643/gems/ansible_spec-0.2.1/lib/ansible_spec/load_ansible.rb:95:in `block in get_dynamic_inventory'
/Users/Phil/.rvm/gems/ruby-2.0.0-p643/gems/ansible_spec-0.2.1/lib/ansible_spec/load_ansible.rb:91:in `each'
/Users/Phil/.rvm/gems/ruby-2.0.0-p643/gems/ansible_spec-0.2.1/lib/ansible_spec/load_ansible.rb:91:in `get_dynamic_inventory'
/Users/Phil/.rvm/gems/ruby-2.0.0-p643/gems/ansible_spec-0.2.1/lib/ansible_spec/load_ansible.rb:11:in `load_targets'
/Users/Phil/.rvm/gems/ruby-2.0.0-p643/gems/ansible_spec-0.2.1/lib/ansible_spec/load_ansible.rb:198:in `get_properties'
I can understand that it's not possible to interpret every dynamic inventory (since you can make it return whatever you want), however it would be great if ansible_spec could at least work with the standard ec2.py.
philbert commented
I'm preparing a pull request for this
volanja commented
It is looks good!!
Thank you!