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

node['chocolatey']['upgrade'] attribute not working #12

Open
tyrken opened this issue Apr 2, 2014 · 3 comments
Open

node['chocolatey']['upgrade'] attribute not working #12

tyrken opened this issue Apr 2, 2014 · 3 comments

Comments

@tyrken
Copy link

tyrken commented Apr 2, 2014

I was hoping to use the node['chocolatey']['upgrade'] attribute to keep the underlying chocolatey version up to date, but it doesn't seem to work. I think this is due to how the LWRP behaves if the version field is left blank as it is in the chocolatey "chocolatey" resource at the end of the default recipe.

Looking at the code in providers/default.rb, which runs in response to that resource, "package_installed?" will be true as obviously chocolatey is already installed (by the install.ps1 boot-strapper). We don't specify a particular version, so "package_exists?" also returns true. Unfortunately "upgradeable?" takes the latter as gospel so assumes there's nothing to do.

Would you accept a PR to only use @current_resource.exists if the version is not blank?

@tyrken tyrken changed the title chocolatey/upgrade attribute not working node['chocolatey']['upgrade'] attribute not working Apr 2, 2014
@tyrken
Copy link
Author

tyrken commented Apr 2, 2014

Whilst testing a fix for this, it seems chocolatey errors during the upgrade, even if it is OK afterwards. This is a problem that I can only seem to resolve by ignoring some return codes, which is not ideal...

@AnneTheAgile
Copy link

I wonder if with the latest release [1] which mentions fixing retcode issues, if this is still a problem?
https://github.com/chocolatey/chocolatey/wiki/ReleaseNotes

@vtintillier
Copy link

I have the same issue with cookbook version 0.3.0.
chocolatey 0.9.9.5 will not upgrade to 0.9.9.6.

From what I could debug, this is because in providers/default.rb/package_exists? method, we execute choco list -l -r chocolatey, but the chocolatey package itself is not returned by choco list command. So it always return false.

This is because the chocolatey package is not installed by the cookbook. I added chocolatey 'chocolatey' to my cookbook that include the chocolatey one, and I believe it will now work. To be verified once 0.9.9.7 is out.

Maybe the chocolatey cookbook should install the chocolatey package by default?

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

No branches or pull requests

3 participants