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

Handle Chocolatey's new Enhanced Exit Codes #52209

Merged
merged 2 commits into from
Apr 12, 2019

Conversation

twangboy
Copy link
Contributor

What does this PR do?

Chocolatey has started implementing Enhanced Exit Codes that will effect the stability of the Chocolatey module as future versions are released. This PR handles Enhanced Exit Code 2 added to the Chocolatey list function.

What issues does this PR fix or reference?

chocolatey/choco#1758

Tests written?

No

Commits signed with GPG?

Yes

@garethgreenaway
Copy link
Contributor

@twangboy unless this is a CVE, this should go into 2018.3 and we can merge forward.

@twangboy
Copy link
Contributor Author

@garethgreenaway You're right...

@twangboy twangboy force-pushed the fix_choco_retcode branch from d7a85f8 to bfdc47b Compare March 21, 2019 00:20
@twangboy twangboy requested a review from a team as a code owner March 21, 2019 00:20
@twangboy twangboy changed the base branch from 2017.7.9 to 2018.3 March 21, 2019 00:20
Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

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

Not sure if we care to use https://pypi.org/project/enum34/ but I, for one, really like using the Enum class (or IntEnum) from Python 3.4+. It will be nice to have that available. Then we could have something like:

from enum import IntEnum

class ChoclateyExitCode(IntEnum):
    success = 0
    error = 1
    no_result = 2

    @property
    def failed(self):
        return self not in (ExitCode.success, ExitCode.no_result)


# And then used like
if ChoclateyErrorCode(result['retcode']).failed:
    raise CommandExecutionError(...)

There are a number of places having some slightly more user friendly status codes would be nice... but I can wait 🙂

@thatch45 thatch45 merged commit 262516c into saltstack:2018.3 Apr 12, 2019
@twangboy twangboy deleted the fix_choco_retcode branch April 17, 2019 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants