Azure / azure_preview_modules

Azure preview modules for Ansible
https://galaxy.ansible.com/azure/azure_preview_modules
43 stars 49 forks source link

Fixing rule_type reference #377

Closed Zype76 closed 4 years ago

Zype76 commented 4 years ago

Summary: When reviewing https://github.com/ansible/ansible/issues/68744 , I found that the "rule_type" if statement checks 'ev' instead of 'item'. This is preventing it from being parsed properly, and the _snake_to_camel function isn't triggered to filter the options into the desired format.

Links: Reference: https://github.com/Azure/azure_preview_modules/blob/master/library/azure_rm_appgateway.py#L742

Importing the function: https://github.com/Azure/azure_preview_modules/blob/master/library/azure_rm_appgateway.py#L443

Source for _snake_to_camel: https://github.com/Azure/azure_preview_modules/blob/2413dafa6f979a2070843b073830901cc1b1d868/module_utils/common/dict_transformations.py#L77

Testing:

Before: 
"msg": "Error creating the Application Gateway instance: Azure Error: InvalidRequestFormat\nMessage: Cannot parse the request.\nException Details:\n\tError Code: InvalidJson\n\tMessage: Error converting value \"path_based_routing\" to type 'Microsoft.WindowsAzure.Networking.Nrp.Frontend.Contract.Csm.Public.ApplicationGatewayRequestRoutingRuleType'. Path 'properties.requestRoutingRules[0].properties.ruleType', line 1, position 1565."
}

After: 
TASK [Create instance of Application Gateway] ************************************************************************************************************************************************
task path: /home/zephyr/azure/aztest.yml:7
Fred-sun commented 4 years ago

@Zype76 Thank you very much for your interest in Ansible. This plugin is no longer maintained in this repository and has been migrated to https://github.com/ansible-collections/azure Please re-submit this PR in the above repository.

Zype76 commented 4 years ago

@Fred-sun thanks! I've created https://github.com/ansible-collections/azure/pull/99 for the fix.