[Compute] Fix #31885: az vm encryption: Fix request body serialization#31894
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
az vm encryption: Fix reqeust body serializationaz vm encryption: Fix request body serialization
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a request body serialization issue in the VM encryption commands by ensuring the SequenceVersion parameter is properly converted to a string format.
- Converts
SequenceVersionfrom integer to string in both encryption enable and disable operations - Addresses issue #31885 related to request body serialization failures
| @@ -208,7 +208,7 @@ def encrypt_vm(cmd, resource_group_name, vm_name, # pylint: disable=too-many-lo | |||
| 'EncryptionOperation': 'EnableEncryption' if not encrypt_format_all else 'EnableEncryptionFormatAll', | |||
| 'KeyEncryptionKeyURL': key_encryption_key, | |||
| 'KeyEncryptionAlgorithm': key_encryption_algorithm, | |||
There was a problem hiding this comment.
The change from integer to string conversion should be documented with a comment explaining why the string conversion is necessary for request body serialization.
| 'KeyEncryptionAlgorithm': key_encryption_algorithm, | |
| 'KeyEncryptionAlgorithm': key_encryption_algorithm, | |
| # Convert sequence_version to a string to ensure compatibility with JSON serialization for the request body. |
| @@ -334,7 +334,7 @@ def decrypt_vm(cmd, resource_group_name, vm_name, volume_type=None, force=False) | |||
| public_config = { | |||
| 'VolumeType': volume_type, | |||
| 'EncryptionOperation': 'DisableEncryption', | |||
There was a problem hiding this comment.
The change from integer to string conversion should be documented with a comment explaining why the string conversion is necessary for request body serialization.
| 'EncryptionOperation': 'DisableEncryption', | |
| 'EncryptionOperation': 'DisableEncryption', | |
| # Convert sequence_version to a string because public_config is serialized into a JSON object, | |
| # and JSON requires all values to be JSON-compatible types (e.g., strings). |
|
Could you add some test cases for this PR change? |
These commands are covered in tests. |
f6b6b6a to
d619774
Compare
Related command
az vm encryption enable/disableDescription
Fix #31885
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.