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

(MODULES-5383) Remove exit codes arg with feature #84

Merged
merged 2 commits into from
Feb 13, 2019
Merged

(MODULES-5383) Remove exit codes arg with feature #84

merged 2 commits into from
Feb 13, 2019

Conversation

davidtwco
Copy link

When the "usepackageexitcodes" feature is enabled with the
chocolateyfeature resource, this commit ensures that the
--ignore-package-exit-codes argument is not passed to the choco binary
and that the feature is respected.

Previously, the --ignore-package-exit-codes argument would be passed all
the time (on versions of Chocolatey where it existed) and this would
result in the enabling of the "usepackageexitcodes" feature to be
rendered moot.

return false if feature_tags.empty?
feature = feature_tags.first

return true if feature.attributes['enabled'].downcase == 'true'

Choose a reason for hiding this comment

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

This should check if it was explicitly enabled - <feature name="usePackageExitCodes" enabled="true" setExplicitly="false" description="[..snip..]" />

Otherwise this is likely to break all folks - the feature is turned on by default.

Copy link
Author

Choose a reason for hiding this comment

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

I've changed this to check for the feature being enabled explicitly.

Copy link

@ferventcoder ferventcoder left a comment

Choose a reason for hiding this comment

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

The biggest issue I see with this is that Puppet isn't able to handle non-zero values as successful (unless I am missing something). For the feature to work correctly, you would need to have a way to also tell Puppet that the exit codes indicate success.

@davidtwco
Copy link
Author

@ferventcoder I agree. I haven't been using this feature for that reason (originally I thought it might help solve an issue I was having, which lead me to discover that the chocolateyfeature resource for this wasn't having an effect).

Despite this, I do think it makes sense to have the chocolateyfeature resource for this (as shown on the README) have an effect to avoid any confusion and support scenarios where this might be desired (whatever that may be).

@davidtwco
Copy link
Author

@ferventcoder Have you had a chance to take a look at my last comment and this PR?

When the "usepackageexitcodes" feature is enabled with the
chocolateyfeature resource, this commit ensures that the
--ignore-package-exit-codes argument is not passed to the choco binary
and that the feature is respected.

Previously, the --ignore-package-exit-codes argument would be passed all
the time (on versions of Chocolatey where it existed) and this would
result in the enabling of the "usepackageexitcodes" feature to be
rendered moot.
Chocolatey enables the "usepackageexitcodes" by default, therefore this
will break existing behaviour of puppetlabs-chocolatey if it we do not
check that the feature was set explicitly.

This commit adds new methods to the provider to retrieve chocolatey
features from the configuration file. It uses these methods to
verify whether or not the `usepackageexitcodes` configuration setting
is explicitly set to enabled. If it is disabled or implicitly set,
the provider will add the `--ignore-package-exit-codes` parameter when
installing packages as is the existing behavior. If it is explicitly
set to enabled then the provider will *not* pass that parameter.

This is likely to break runs but respects the configuration settings.
@michaeltlombardi
Copy link

Hey, @davidtwco! Thank you so much for this PR! I've caught it up to current and added some additional tests, so we're going to merge! I super appreciate your work on this!

@jpogran jpogran merged commit 823d8fd into puppetlabs:master Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants