From 4132cb9ba65a3435e2a73f3431adca05d4d1556b Mon Sep 17 00:00:00 2001 From: SaurabhSharma-MSFT <38112130+SaurabhSharma-MSFT@users.noreply.github.com> Date: Mon, 6 Mar 2023 15:40:24 -0800 Subject: [PATCH 1/3] {appconfig} Fix kv export special characters --- .../azure/cli/command_modules/appconfig/_kv_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py b/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py index 9d7d83545d0..f5a2915f019 100644 --- a/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py +++ b/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py @@ -283,7 +283,8 @@ def __write_kv_and_features_to_file(file_path, key_values=None, features=None, f elif format_ == 'yaml': yaml.safe_dump(exported_keyvalues, fp, sort_keys=False, width=float('inf')) elif format_ == 'properties': - javaproperties.dump(exported_keyvalues, fp) + for key, value in exported_keyvalues.items(): + fp.write('{}={}\n'.format(key, value)) except Exception as exception: raise FileOperationError("Failed to export key-values to file. " + str(exception)) From 31284c3d0b039596a16c4880d64d69e5c88a8019 Mon Sep 17 00:00:00 2001 From: SaurabhSharma-MSFT <38112130+SaurabhSharma-MSFT@users.noreply.github.com> Date: Mon, 6 Mar 2023 15:41:28 -0800 Subject: [PATCH 2/3] {appconfig} Fix kv export special characters --- .../azure/cli/command_modules/appconfig/_kv_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py b/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py index f5a2915f019..2a3787cae49 100644 --- a/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py +++ b/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py @@ -284,7 +284,7 @@ def __write_kv_and_features_to_file(file_path, key_values=None, features=None, f yaml.safe_dump(exported_keyvalues, fp, sort_keys=False, width=float('inf')) elif format_ == 'properties': for key, value in exported_keyvalues.items(): - fp.write('{}={}\n'.format(key, value)) + fp.write('{}={}\n'.format(key, value)) except Exception as exception: raise FileOperationError("Failed to export key-values to file. " + str(exception)) From 77d371a42c90f349d06299c85e250117e5b2bb09 Mon Sep 17 00:00:00 2001 From: SaurabhSharma-MSFT <38112130+SaurabhSharma-MSFT@users.noreply.github.com> Date: Wed, 17 May 2023 13:18:53 -0700 Subject: [PATCH 3/3] Update src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py Co-authored-by: Albert Ofori <102393878+albertofori@users.noreply.github.com> --- .../azure/cli/command_modules/appconfig/_kv_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py b/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py index 2a3787cae49..ea5e952533c 100644 --- a/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py +++ b/src/azure-cli/azure/cli/command_modules/appconfig/_kv_helpers.py @@ -284,7 +284,7 @@ def __write_kv_and_features_to_file(file_path, key_values=None, features=None, f yaml.safe_dump(exported_keyvalues, fp, sort_keys=False, width=float('inf')) elif format_ == 'properties': for key, value in exported_keyvalues.items(): - fp.write('{}={}\n'.format(key, value)) + fp.write('{}={}\n'.format(javaproperties.escape(key), value)) except Exception as exception: raise FileOperationError("Failed to export key-values to file. " + str(exception))