ansible-community / community-examples

Repository for community examples
GNU Affero General Public License v3.0
4 stars 1 forks source link

examples: item2dict #5

Open samccann opened 2 years ago

samccann commented 2 years ago

Another set from @jillr https://github.com/ansible-collections/amazon.aws/blob/main/tests/integration/targets/ec2_vpc_dhcp_option/tasks/main.yml

We could extract the item2dict examples from those tests. I do wonder how to 'convert' them to less complexity (focusing on item2dict but not on all the aws fun around it)

jillr commented 2 years ago

Maybe we just need to detail what the before and after data is? Amazon frequently gives us results that look like:

        {
            'Key': 'string1',
            'Value': 'string2'
        },

The use of items2dict here lets us turn that into a dictionary with k:v pairs of {'string1': 'string2'} which is much easier to work with.

Andersson007 commented 2 years ago

@samccann @jillr yeah, thought of the same, we should generalize the examples using core functionality whenever possible, otherwise, i'm afraid, we have to replicate aws CI here..(as well as CI of other projects in the future which doesn't feel good). I've set up CI here. It runs sanity and integration tests. I also created a primitive test task to test the CI - it works as expected.

Screenshot from 2021-12-21 08-51-50

Screenshot from 2021-12-21 08-52-26

OK, I'll think how to extract the item2dict examples (make them general) from those tests and add another dedicated test task.

Andersson007 commented 2 years ago

Done https://github.com/ansible-community/community-examples/pull/9. Any thoughts?