Convert key to snake. Fixes #36845. (#36887) (#36904)

This commit is contained in:
Chris Houseknecht 2018-03-01 10:03:32 -05:00 committed by GitHub
parent 808f45db55
commit ac11027d58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,7 +192,7 @@ class KubernetesAnsibleModule(AnsibleModule):
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):
@ -200,12 +200,12 @@ class KubernetesAnsibleModule(AnsibleModule):
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(