az repos policy create can't read file
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start in azext_devops/dev/repos/policy.py at create_policy_configuration_file and its json.load call. Reproduce the Windows PowerShell-generated template with az repos policy create --config, then inspect how the file is opened and how the command handles the reported JSONDecodeError. Done means the command can read the described file without this failure.
Written by the indexing model from the issue text.
Description
I create a file manually and named if template.json
I did some token replacement and saved it using this command
Out-File -FilePath $templateFile -InputObject $updatedContents
Whatever output PS outputs is not recognized by az repos policy create --config
- probably UTF-8
I changed it to ASCII encoding and it worked fine
Out-File -FilePath $templateFile -InputObject $updatedContents -Encoding ASCII
Command Name
az repos policy create
Extension Name: azure-devops. Version: 0.26.0.
Errors:
The command failed with an unexpected error. Here is the traceback:
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 718, in _run_job
File "C:\Users\kkilton\.azure\cliextensions\azure-devops\azext_devops\dev\common\exception_handler.py", line 31, in azure_devops_exception_handler
reraise(*sys.exc_info())
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\six.py", line 719, in reraise
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users\kkilton\.azure\cliextensions\azure-devops\azext_devops\dev\repos\policy.py", line 75, in create_policy_configuration_file
configuration = json.load(f)
File "json\__init__.py", line 293, in load
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
az repos policy create --config {}
Expected Behavior
Notepad++ can read this file just fine and no comparison issues between the files, AZ CLI should be able to read the file.
Environment Summary
Windows-10-10.0.19045-SP0
Python 3.10.10
Installer: MSI
azure-cli 2.47.0 *
Extensions:
azure-devops 0.26.0
Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
Additional Context
- Dominant language
- Python
- Stars
- 683
- Forks
- 278
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-devops-cli-extension
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
Azure/azure-devops-cli-extension#1519 ·
-
Feature
Difficulty 3/5 1-2 days Newbie friendliness 64/100
Azure/azure-devops-cli-extension#1510 ·
-
Feature
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Azure/azure-devops-cli-extension#1509 · 1 comment ·
-
Feature
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Azure/azure-devops-cli-extension#1503 ·
-
Feature
Difficulty 3/5 1-2 days Newbie friendliness 64/100
Azure/azure-devops-cli-extension#1499 · 2 comments ·
All issues in Azure/azure-devops-cli-extension
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100