Skip to content
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

Set a non-zero exit code when a resource not found #561

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

anmenaga
Copy link
Collaborator

@anmenaga anmenaga commented Sep 26, 2024

PR Summary

At this time dsc resource ... commands are just printing a Resource not found error, but exit code is 0.
This PR changes exit code to 7 in such cases.

before change:

PS C:\DSCv3> dsc resource get -r dfg/sdfg                     
2024-09-26T21:07:27.371778Z ERROR Resource not found: dfg/sdfg
PS C:\DSCv3> $LASTEXITCODE
0

after change:

PS C:\DSCv3> dsc resource get -r dfg/sdfg                     
2024-09-26T21:08:16.539682Z ERROR Resource not found: dfg/sdfg
PS C:\DSCv3> $LASTEXITCODE
7

Copy link
Collaborator

@tgauth tgauth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this exit code need to be added to the *.dsc.resource.jsons as part of this PR?

@anmenaga
Copy link
Collaborator Author

does this exit code need to be added to the *.dsc.resource.jsons as part of this PR?

No. This error signals a problem in dsc.exe discovery itself.

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When dsc itself is used as a resource this error can come up so it should be added to the group, assertion, parallel resource manifests

@anmenaga
Copy link
Collaborator Author

Updated group, assertion, parallel resource manifests as suggested.

@SteveL-MSFT
Copy link
Member

@anmenaga you need to add the new version of cc to our CFS feed

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Oct 3, 2024
Merged via the queue into PowerShell:main with commit b6c6983 Oct 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants