-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend exitCodes to support Hexidecimal error codes #407
Comments
You're correct, the JSON Schema forbids non-integers for the property names in the definition of DSC/schemas/src/resource/manifest.yaml Lines 383 to 395 in 7404ad8
The implementation for DSC expects the exit codes to be an integer: DSC/dsc_lib/src/dscresources/resource_manifest.rs Lines 57 to 59 in 7404ad8
You can add the following repro manifest to your path to see how DSC behaves: {
"$schema": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/resource/manifest.json",
"type": "DSC.Repro/Example",
"version": "0.1.0",
"description": "Repro behavior when exit codes are hexadecimal.",
"get": {
"executable": "repro",
"input": "stdin"
},
"schema": {
"command": {
"executable": "repro",
"args": [
"--schema"
]
}
},
"exitCodes": {
"0": "Success",
"1": "Error",
"-2147024891": "testing hexadecimal as integer"
}
} dsc resource list DSC.Repro/Example
dsc resource list DSC.Repro/Example
| ConvertFrom-Json
| Select-Object -ExpandProperty manifest
| Select-Object -ExpandProperty exitCodes
| ConvertTo-Json Type Kind Version Caps RequireAdapter Description
-------------------------------------------------------------------------------------------------------------
DSC.Repro/Example Resource 0.1.0 g----- Repro behavior when exit codes are hexadecimal.
{
"0": "Success",
"1": "Error",
"-2147024891": "testing hexadecimal as integer"
} However, if you update the manifest to use hex format for the exit code: {
// ... rest of the manifest
"exitCodes": {
"0": "Success",
"1": "Error",
"-2147024891": "testing hexadecimal as integer",
"0x80070005": "testing hexadecimal as hex format"
}
} DSC raises an error - it doesn't have any built-in handling for converting the string dsc resource list DSC.Repro/Example 2024-04-17T14:28:27.325654Z WARN Manifest: C:\code\pwsh\DSCv3\bin\debug\repro.dsc.resource.json
JSON: expected `"` at line 22 column 11
Type Kind Version Caps RequireAdapter Description
------------------------------------------------------ I can definitely update the schema definitions to allow negative integers, but unless the source code for DSC is updated, I can't update it to allow numbers in hexadecimal format. |
Prior to this change, the JSON schema for the `exitCodes` property of resource manifests only supported positive integers as exit codes. DSC itself supports negative integers as exit codes, and some apps return negative integers as exit codes for hexadecimal exit codes, like `-2147024891` for `0x80070005`, "Access denied." This change: - Updates both the source and composed schemas to allow negative integers. - Updates the reference documentation to clarify that you must specify integers, that you can't use any alternate formats for those integers, and that the keys in YAML must be wrapped in quotes for parsing. - Addresses PowerShell#407 by making the schema compliant with the implementation.
Prior to this change, the JSON schema for the `exitCodes` property of resource manifests only supported positive integers as exit codes. DSC itself supports negative integers as exit codes, and some apps return negative integers as exit codes for hexadecimal exit codes, like `-2147024891` for `0x80070005`, "Access denied." This change: - Updates both the source and composed schemas to allow negative integers. - Updates the reference documentation to clarify that you must specify integers, that you can't use any alternate formats for those integers, and that the keys in YAML must be wrapped in quotes for parsing. - Addresses PowerShell#407 by making the schema compliant with the implementation.
Prior to this change, the JSON schema for the `exitCodes` property of resource manifests only supported positive integers as exit codes. DSC itself supports negative integers as exit codes, and some apps return negative integers as exit codes for hexadecimal exit codes, like `-2147024891` for `0x80070005`, "Access denied." This change: - Updates both the source and composed schemas to allow negative integers. - Updates the reference documentation to clarify that you must specify integers, that you can't use any alternate formats for those integers, and that the keys in YAML must be wrapped in quotes for parsing. - Addresses PowerShell#407 by making the schema compliant with the implementation.
Prior to this change, the JSON schema for the `exitCodes` property of resource manifests only supported positive integers as exit codes. DSC itself supports negative integers as exit codes, and some apps return negative integers as exit codes for hexadecimal exit codes, like `-2147024891` for `0x80070005`, "Access denied." This change: - Updates both the source and composed schemas to allow negative integers. - Updates the reference documentation to clarify that you must specify integers, that you can't use any alternate formats for those integers, and that the keys in YAML must be wrapped in quotes for parsing. - Addresses PowerShell#407 by making the schema compliant with the implementation.
Prior to this change, the JSON schema for the `exitCodes` property of resource manifests only supported positive integers as exit codes. DSC itself supports negative integers as exit codes, and some apps return negative integers as exit codes for hexadecimal exit codes, like `-2147024891` for `0x80070005`, "Access denied." This change: - Updates both the source and composed schemas to allow negative integers. - Updates the reference documentation to clarify that you must specify integers, that you can't use any alternate formats for those integers, and that the keys in YAML must be wrapped in quotes for parsing. - Addresses PowerShell#407 by making the schema compliant with the implementation.
…-code-schemas (GH-407) Support negative integers in manifest `exitCodes`
Fixed by #410 |
Summary of the new feature / enhancement
While I was playing around an idea for a DSC Resource, I received Exit code
-2147024891
(0x80070005
) Access Denied when trying to execute a binary which required elevation. I tried to represent this error in theexitCodes
section of a DSC Resource manifest, but it does not appear to match the regex that dsc is using to validatedexitCodes
.The feature request is that the regex be updated to support negative/Hexidecimal exit codes.
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: