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

No way to install new cheffish version in single chef-client run once it got activated #89

Closed
poliva83 opened this issue Oct 16, 2015 · 6 comments

Comments

@poliva83
Copy link

I used chef-client 12.4.1 which has cheffish version 1.2. I hit issue #50 when trying to create organization with members.

I then used chef_gem at compile time to install version 1.5.0 (1.6.0 conflicts with chef-client 12.4.1) however I can not activate 1.5.0 since chef-client seems to have already activated 1.2. Only workaround (which kind of stinks) I have is to stop chef-client after 1.5.0 is installed and then trigger a new chef-client run and it seems to pick up latest version. Same result even if you have a chef_gem resource removing 1.2 (doesn't matter as its already activated) before installing 1.5.0. Is there anyway to get chef-client to deactivate cheffish 1.2 during chef-client run?

[poliva-chef-server-be-1a] Starting Chef Client, version 12.4.1
 resolving cookbooks for run list: ["bb_chef_server_cluster::backend", "bb_chef_server_cluster::manage_rbac"]
 Synchronizing Cookbooks:
   - bb_apt
   - bb_chef_server_cluster
   - bb_lvm
   - bb_nsupdate
   - apt
   - lvm
   - chef-ingredient
   - apt-chef
   - yum-chef
   - yum
 Compiling Cookbooks...
 Recipe: bb_chef_server_cluster::default
   * chef_gem[install cheffish version 1.5.0] action install
     - install version 1.5.0 of package cheffish
 ["1.5.0", "1.2"]

   ================================================================================
   Recipe Compile Error in /var/chef/cache/cookbooks/bb_chef_server_cluster/recipes/manage_rbac.rb
   ================================================================================

   Gem::LoadError
   --------------
   can't activate cheffish-1.5.0, already activated cheffish-1.2

   Cookbook Trace:
   ---------------
     /var/chef/cache/cookbooks/bb_chef_server_cluster/recipes/manage_rbac.rb:19:in `from_file'

   Relevant File Content:
   ----------------------
   /var/chef/cache/cookbooks/bb_chef_server_cluster/recipes/manage_rbac.rb:

    12:  output = `#{File.join(RbConfig::CONFIG['bindir'], 'gem')} list | grep cheffish`.slice(/\(.*\)/)
    13:  versions = output[1..-2].split(',').collect{|x| x.strip} unless output.nil?
    14:  versions ||= []
    15:  p versions
    16:
    17:  require 'English'
    18:  #require 'cheffish'
    19>> gem 'cheffish' , '=1.5.0'
    20:  require 'cheffish'
    21:
    22:  ruby_block "only modify rbac content on master backend" do
    23:    block do
    24:    end
    25:    only_if { `/usr/bin/chef-server-ctl ha-status` && $CHILD_STATUS.to_i.eql?(0) }
    26:    only_if { `/usr/bin/chef-server-ctl ha-status | /bin/grep 'cluster status = master'` && $CHILD_STATUS.to_i.eql?(0) }
    27:  end
    28:

@poliva83 poliva83 changed the title No way to install later cheffish in single chef-client run once it got activated No way to install new cheffish version in single chef-client run once it got activated Oct 16, 2015
@randomcamel
Copy link
Contributor

I'm not a Ruby VM expert, but in general hot-swapping code is really hard, and I'd be very surprised if Ruby has acquired this capability since the last time I looked.

Is there a place you can put a chef gem install in before chef-client starts?

@poliva83
Copy link
Author

@randomcamel I ended up just baking chef-client into my image removing 1.2 and installing 1.5.0 cheffish gem. Then at deploy time the correct version of cheffish will get activated by chef-client and used.

@randomcamel
Copy link
Contributor

@poliva83 Okay to close this? I don't think it's really a Cheffish-specific problem.

@poliva83
Copy link
Author

@randomcamel I do have a workaround so I am fine to close. However I did discuss problem with @jkeiser yesterday and he mentioned to keep it open since others could potentially hit same problem.

@jkeiser
Copy link
Contributor

jkeiser commented Dec 10, 2015

@poliva83 this commit to chef should fix this: chef/chef#4264

Chef 12.6 should have the fix!

@jkeiser jkeiser closed this as completed Dec 10, 2015
@poliva83
Copy link
Author

@jkeiser Thanks I will check try this out when 12.6 is released.

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