Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Depend on Mixlib-install for install logic #105

Closed
wants to merge 5 commits into from

Conversation

wjordan
Copy link

@wjordan wjordan commented Feb 17, 2016

This branch addresses #46 by depending on the new mixlib-install library to provide the install.sh implementation, as suggested by @lamont-granquist in his comment. The changes are substantial so I'm just sharing this PR now for feedback/discussion and in hopes others might find this immediately useful.

  • The latest alpha version of mixlib-install is installed via chef_gem.
  • To replace the platform-detection duplication in OmnibusTrucker#collect_attributes, the platform_detection.sh portion of the install script is invoked in a subprocess (via backticks ``).
    • Should this make use of mixlib-shellout instead for best compatibility?
    • I assume the Ohai attributes can't be used directly with the Omnitruck API here for legacy purposes?
  • Added a simple LWRP that wraps the default installation recipe with a version attribute (ref. Need chef_update resource to use this chef/mixlib-install#1). Simple basic usage examples:
omnibus_updater :latest
omnibus_updater "11.18.12"
omnibus_updater "12"
  • Removed the package-downloader code path, so this version only currently supports installation via the #install_command provided by mixlib-install. (The upside is that this drastically simplifies the implementation!) I figure an improvement to this PR could leverage an existing package resource similar to what @lamont-granquist described in his comment.
  • Bumped the cookbook version to 2.0.0 because I figured that these changes would be significant enough to break expected behavior.
  • :prerelease is not yet re-implemented, though it could be with a bit more work.
  • The exec patch from exec() chef-client to resume the run after updating the omnibus install #102 is also included in this PR since I found it helpful for my use-case, though it's not necessary and could be extracted from this PR if needed.

Joshua Kwan added 2 commits February 16, 2016 02:58
Rather than kill the chef client and leave it to the user to pick up the
pieces and, in most cases, simply resume the run, do that by default by
exec'ing chef-client again in the ruby_block to start using the new
version.

The original behavior is still accessible via attributes.
- Do not allow it when chef-zero is being used (chef client local mode)
  If you do, it only re-execs the worker process, which is not the
  process running the chef-zero server.
- Add argv on as well in case of a runlist override
- Skip the install notifier, cut out the middleman. If you include the
  ::install recipe, you want to install, and it will always happen after
  the remote_file. This fixes #65, at the cost of making a few more
  assumptions.
@wjordan
Copy link
Author

wjordan commented Feb 19, 2016

Note that the changes in this PR largely reproduce the chef-ingredient cookbook, which I assume will eventually make this community cookbook obsolete. However, chef-ingredient requires chef >= 12.5.0 which won't be of any help to those trying to upgrade chef-clients below that version.

@lamont-granquist
Copy link

I don't have time to review but that's the direction that the updating-of-chef-client needs to go.

If it doesn't work to rewrite this cookbook that much, then i'd be good to have an omnibus_updater2 fork.

I agree it overlaps with chef_ingredient, but I think its a good thing to do anyway.

content 'conflict=nocheck\naction=nocheck'
only_if { node['os'] =~ /^solaris/ }
chef_gem "mixlib-install" do
version '0.8.0.alpha.6'
Copy link
Contributor

Choose a reason for hiding this comment

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

This should get updated for the 1.X releases

@chef-supermarket
Copy link

Hi. I am an automated pull request bot named Curry. There are commits in this pull request whose authors are not yet authorized to contribute to Chef Software, Inc. projects or are using a non-GitHub verified email address. To become authorized to contribute, you will need to sign the Contributor License Agreement (CLA) as an individual or on behalf of your company. You can read more on Chef's blog.

Non-GitHub Verified Committers

There are 1 commit author(s) whose commits are authored by a non-GitHub verified email address. Chef will have to manually verify that they are authorized to contribute.

Please sign the CLA here.

tas50 added a commit to chef-boneyard/chef-client that referenced this pull request Dec 27, 2016
This is based off the work done in chef-boneyard/omnibus_updater#105, but updated for some of the new mixlib-install functionality and updated to be a custom resource. This allows simple update functionality without the mess of the ruby implementation in the omnibus_updater cookbook. It is going to require additional testing and functionality, but I wanted to get this 1/2 working bit out there.

Signed-off-by: Tim Smith <tsmith@chef.io>
tas50 added a commit to chef-boneyard/chef-client that referenced this pull request Jan 16, 2017
This is based off the work done in chef-boneyard/omnibus_updater#105, but updated for some of the new mixlib-install functionality and updated to be a custom resource. This allows simple update functionality without the mess of the ruby implementation in the omnibus_updater cookbook. It is going to require additional testing and functionality, but I wanted to get this 1/2 working bit out there.

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50
Copy link
Contributor

tas50 commented Jan 16, 2017

For anyone interested in this work I've taken the heart of the code and moved it into a pure resource in chef-client in this PR: chef-boneyard/chef-client#452

This would allow anyone to use the resource in their cookbook or apply the simple attribute driven recipe. It includes the new exit code logic and the version logic is a lot simpler due to improvements to mixlib-install over the last year.

tas50 added a commit to chef-boneyard/chef-client that referenced this pull request Jan 16, 2017
This is based off the work done in chef-boneyard/omnibus_updater#105, but updated for some of the new mixlib-install functionality and updated to be a custom resource. This allows simple update functionality without the mess of the ruby implementation in the omnibus_updater cookbook. It is going to require additional testing and functionality, but I wanted to get this 1/2 working bit out there.

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50 tas50 closed this Mar 7, 2017
@tas50
Copy link
Contributor

tas50 commented Mar 7, 2017

Closing this one out since I've reworked it into a PR to chef-client. I super appreciate everything you did here. This was a great push to making this cookbook do what everyone expects it to do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants