From 1ea02938784f944e8c5a75207bedda033d7ff518 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 20 Sep 2017 13:03:45 +1000 Subject: [PATCH] CamelConversion: fix to not convert string values (#30595) --- .../powershell/Ansible.ModuleUtils.CamelConversion.psm1 | 4 ---- .../win_module_utils/library/camel_conversion_test.ps1 | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CamelConversion.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CamelConversion.psm1 index dda7185f692..4de80c74199 100644 --- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CamelConversion.psm1 +++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CamelConversion.psm1 @@ -30,8 +30,6 @@ Function Convert-ListToSnakeCase($list) { $new_value = Convert-DictToSnakeCase -dict $value } elseif ($value -is [Array]) { $new_value = Convert-ListToSnakeCase -list $value - } elseif ($value -is [String]) { - $new_value = Convert-StringToSnakeCase -string $value } else { $new_value = $value } @@ -55,8 +53,6 @@ Function Convert-DictToSnakeCase($dict) { $snake_dict.$snake_key = Convert-DictToSnakeCase -dict $value } elseif ($value -is [Array]) { $snake_dict.$snake_key = Convert-ListToSnakeCase -list $value - } elseif ($value -is [String]) { - $snake_dict.$snake_key = Convert-StringToSnakeCase -string $value } else { $snake_dict.$snake_key = $value } diff --git a/test/integration/targets/win_module_utils/library/camel_conversion_test.ps1 b/test/integration/targets/win_module_utils/library/camel_conversion_test.ps1 index d8d704f5aab..45de2bd7790 100644 --- a/test/integration/targets/win_module_utils/library/camel_conversion_test.ps1 +++ b/test/integration/targets/win_module_utils/library/camel_conversion_test.ps1 @@ -51,7 +51,8 @@ foreach ($entry in $output_dict.GetEnumerator()) { Assert-Equals -actual $inner_list_hash.Name -expected $inner_list_hash.Value } } elseif ($inner_list -is [String]) { - Assert-Equals -actual $inner_list -expected "string_two" + # this is not a string key so we need to keep it the same + Assert-Equals -actual $inner_list -expected "stringTwo" } else { Assert-Equals -actual $inner_list -expected 0 }