azure-cli: Error when providing relative path to json file with --settings parameter
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az functionapp config appsettings set
Errors:
The command failed with an unexpected error. Here is the traceback:
not enough values to unpack (expected 2, got 1)
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\util.py", line 244, in shell_safe_json_parse
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\util.py", line 250, in shell_safe_json_parse
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\ast.py", line 48, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 1
\Stage\QueueProcessing\@queueProcessingAppSettings-CI.json
^
SyntaxError: unexpected character after line continuation character
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli\azure\cli\command_modules\appservice\custom.py", line 208, in update_app_settings
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\util.py", line 252, in shell_safe_json_parse
knack.util.CLIError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\knack\knack\cli.py", line 206, in invoke
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\commands\__init__.py", line 603, in execute
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\commands\__init__.py", line 661, in _run_jobs_serially
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\commands\__init__.py", line 652, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli\azure\cli\command_modules\appservice\commands.py", line 55, in _polish_bad_errors
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\commands\__init__.py", line 631, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli-core\azure\cli\core\__init__.py", line 485, in default_command_handler
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-umfcm_n2\azure-cli\azure\cli\command_modules\appservice\custom.py", line 219, in update_app_settings
ValueError: not enough values to unpack (expected 2, got 1)
To Reproduce:
Create a powershell script that executes the command below. The script and settingsFile are in different folders. So a relative path is provided to the $settingsFile.
az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings $settingsFile --slot $slot
The powershell script accepts 4 parameters
Param(
# Name of the function app
[Parameter(Mandatory = $true)]
[string]$functionAppName,
# Name of the Resource Group in Azure
[Parameter(Mandatory = $true)]
[string]$resourceGroupName,
# Path of the settings file, prefix with @ symbol. Example: -settingsFile @queueProcessingAppSettings-stageSlot.json
[Parameter(Mandatory = $true)]
[string]$settingsFile,
# Name of slot.
[ValidateSet("stage", "production")]
[Parameter(Mandatory = $true)]
[string]$slot
)
The powershell script is executed like this:
.\functionAppSettings.ps1 -functionAppName wbqueueprocessing -resourceGroupName WB-CI -settingsFile "\Stage\QueueProcessing\@queueProcessingAppSettings-CI.json" -slot stage
Expected Behavior
Azure CLI updates application settings in Azure for the function app
Environment Summary
Windows-10-10.0.17763-SP0
Python 3.6.6
Shell: powershell.exe
azure-cli 2.0.76 *
Additional Context
Just to provide some context to the problem hereā¦I created an Azure CLI script to deploy function apps to 5 different environments that have a production/stage slot. So my repository is structured in a way to make it easy to find these json settings files in their appropriate folder instead of having the script and 20 json files in one folder.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (7 by maintainers)
@jiasli That was it, you solved my problem. Thank you so much.