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

Reinstalls elasticserach every chef run #404

Closed
spuder opened this issue Dec 4, 2015 · 5 comments
Closed

Reinstalls elasticserach every chef run #404

spuder opened this issue Dec 4, 2015 · 5 comments

Comments

@spuder
Copy link
Contributor

spuder commented Dec 4, 2015

If you attempt to install a newer version of elasticsearch than the cookbook version, it will attempt to download elasticsearch every chef run. I believe this is because the checksums are hard coded into the cookbook, and if the checksum is missing, it optimistically downloads elasticsearch again.

Took me a while to figure out what was going on, but I realized there are two workarounds.

  • Always update your cookbook version when updating your release version.

or

  • Always provide the checksum (download from elasticwebsite and run shasum -a 256 )
    node['elasticsearch']['version'] = "2.1.0"
    node['elasticsearch']['checksums']['2.1.0']['debian'] = '099fdeb7b3903ce8cea7d39b577ed6445b78b64d14dd2664fd2ca1e0896691dd'

I think the following improvements could be made to help others who might fall into this situation.

  1. Document that you should always update your cookbook when updating elasticsearch versions. If cookbook versions are tightly coupled with elsticsearch releases (assuming that is the plan, yes?), then there really is no need to ever set node['elasticsearch']['version'] in your role/wrapper cookbook. This is different from how most other cookbooks work. Upgrading just requires that you bump your berksfile version. (which is a fantastic design).
  2. Provide a chef warning if node['elasticsearch']['version'] is different than the default version attribute, and checksum is not provided.
@martinb3
Copy link
Contributor

martinb3 commented Jan 8, 2016

@spuder The Chef file providers have changed significantly over the 11.x and 12.x time frame. Could you tell us what version of Chef you saw this under?

@spuder
Copy link
Contributor Author

spuder commented Jan 8, 2016

Using chef 12.5.1 with cookbook version 2.0.0.

It should be pretty easy to reproduce. Use the 2.0.0 cookbook and try and install elasticsearch 2.1.0 (since there is no 2.1.0 checksum defined in the cookbook).

I only noticed the problem when I was on a really slow internet connection. (Tethered to my cellphone).

I can try and reproduce this again today with the latest chef 12.6.0

@martinb3
Copy link
Contributor

martinb3 commented Jan 8, 2016

Are you sure it's reinstalling every time? I was able to see in the logs that it redownloads the file, but it skips reinstalling it for me:

       [2016-01-08T17:04:15+00:00] DEBUG: dpkg_package[/tmp/kitchen/cache/elasticsearch-2.1.1.deb] current version is 2.1.1
       [2016-01-08T17:04:15+00:00] DEBUG: dpkg_package[/tmp/kitchen/cache/elasticsearch-2.1.1.deb] /tmp/kitchen/cache/elasticsearch-2.1.1.deb 2.1.1 already installed
       [2016-01-08T17:04:15+00:00] DEBUG: dpkg_package[/tmp/kitchen/cache/elasticsearch-2.1.1.deb] is already installed - nothing to do
        (up to date)

I think adding the warning makes sense 👍

@spuder
Copy link
Contributor Author

spuder commented Jan 8, 2016

Yes, the issue is misleading. The real problem isn't that the package is reinstalled, but rather that the package is unnecessarily downloaded every time.

@martinb3
Copy link
Contributor

martinb3 commented Jan 8, 2016

I've added a warning to help people that forget to add a checksum. Thanks @spuder!

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

2 participants