Skip to content

Commit

Permalink
Convert key to snake. Fixes #36845. (#36887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Houseknecht authored and maxamillion committed Mar 1, 2018
1 parent f5684ac commit 5c65fa3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ansible/module_utils/k8s/common.py
Expand Up @@ -192,20 +192,20 @@ def resource_to_parameters(self, resource):
elif key in self.helper.argspec and value is not None:
parameters[key] = value
elif isinstance(value, dict):
self._add_parameter(value, [key], parameters)
self._add_parameter(value, [to_snake(key)], parameters)
return parameters

def _add_parameter(self, request, path, parameters):
for key, value in iteritems(request):
if path:
param_name = '_'.join(path + [to_snake(key)])
else:
param_name = self.helper.attribute_to_snake(key)
param_name = to_snake(key)
if param_name in self.helper.argspec and value is not None:
parameters[param_name] = value
elif isinstance(value, dict):
continue_path = copy.copy(path) if path else []
continue_path.append(self.helper.attribute_to_snake(key))
continue_path.append(to_snake(key))
self._add_parameter(value, continue_path, parameters)
else:
self.fail_json(
Expand Down

0 comments on commit 5c65fa3

Please sign in to comment.