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

Removal of Old Gems Fails #121

Closed
kemra102 opened this issue Jan 4, 2017 · 5 comments
Closed

Removal of Old Gems Fails #121

kemra102 opened this issue Jan 4, 2017 · 5 comments

Comments

@kemra102
Copy link

kemra102 commented Jan 4, 2017

Cookbook version

4.0.4

Chef-client version

12.17.44

Platform Details

CentOS 7.2.1511 (Core)

Scenario:

Using any resource from this cookbook fails as the new Gems conflict with the old ones.

Steps to Reproduce:

  1. Use a pre-4.x version of the cookbook to create some lvm resources.
  2. Update to a 4.x release of the cookbook.

Expected Result:

Old Gems should be removed, new Gems should be installed & Chef run continues without any changes to the system otherwise.

Actual Result:

Chef run fails. It claims the old Gems are removed but cannot install the new ones as the binaries conflict with the old ones:

* lvm_physical_volume[/dev/sdb] action create
    * chef_gem[/dev/sdb_di-ruby-lvm-attrib_removal] action remove (up to date)
    * chef_gem[/dev/sdb_di-ruby-lvm_removal] action remove (up to date)
    * chef_gem[chef-ruby-lvm-attrib] action install
      
      ================================================================================
      Error executing action `install` on resource 'chef_gem[chef-ruby-lvm-attrib]'
      ================================================================================
      
      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '1'
      ---- Begin output of /opt/chef/embedded/bin/gem install chef-ruby-lvm-attrib -q --no-rdoc --no-ri -v "0.0.28" ----
      STDOUT: 
      STDERR: ERROR:  Error installing chef-ruby-lvm-attrib:
        "generate_field_data" from chef-ruby-lvm-attrib conflicts with installed executable from di-ruby-lvm-attrib
      ---- End output of /opt/chef/embedded/bin/gem install chef-ruby-lvm-attrib -q --no-rdoc --no-ri -v "0.0.28" ----
      Ran /opt/chef/embedded/bin/gem install chef-ruby-lvm-attrib -q --no-rdoc --no-ri -v "0.0.28" returned 1
      
      Cookbook Trace:
      ---------------
      /var/chef/cache/cookbooks/lvm/libraries/lvm.rb:44:in `rescue in require_lvm_gems'
      /var/chef/cache/cookbooks/lvm/libraries/lvm.rb:20:in `require_lvm_gems'
      /var/chef/cache/cookbooks/lvm/libraries/provider_lvm_physical_volume.rb:46:in `action_create'
      
      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/lvm/libraries/lvm.rb
      
       44:     chef_gem 'chef-ruby-lvm-attrib' do
       45:       action :install
       46:       version node['lvm']['chef-ruby-lvm-attrib']['version']
       47:       compile_time true
       48:     end
       49: 
      
      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/lvm/libraries/lvm.rb:44:in `rescue in require_lvm_gems'
      
      chef_gem("chef-ruby-lvm-attrib") do
        package_name "chef-ruby-lvm-attrib"
        action [:install]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        declared_type :chef_gem
        cookbook_name "sbi_lvm"
        version "0.0.28"
        compile_time true
        gem_binary "/opt/chef/embedded/bin/gem"
      end
      
      Platform:
      ---------
      x86_64-linux
      
    
    ================================================================================
    Error executing action `create` on resource 'lvm_physical_volume[/dev/sdb]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    chef_gem[chef-ruby-lvm-attrib] (/var/chef/cache/cookbooks/lvm/libraries/lvm.rb line 44) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
    ---- Begin output of /opt/chef/embedded/bin/gem install chef-ruby-lvm-attrib -q --no-rdoc --no-ri -v "0.0.28" ----
    STDOUT: 
    STDERR: ERROR:  Error installing chef-ruby-lvm-attrib:
        "generate_field_data" from chef-ruby-lvm-attrib conflicts with installed executable from di-ruby-lvm-attrib
    ---- End output of /opt/chef/embedded/bin/gem install chef-ruby-lvm-attrib -q --no-rdoc --no-ri -v "0.0.28" ----
    Ran /opt/chef/embedded/bin/gem install chef-ruby-lvm-attrib -q --no-rdoc --no-ri -v "0.0.28" returned 1
    
    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/lvm/libraries/lvm.rb:44:in `rescue in require_lvm_gems'
    /var/chef/cache/cookbooks/lvm/libraries/lvm.rb:20:in `require_lvm_gems'
    /var/chef/cache/cookbooks/lvm/libraries/provider_lvm_physical_volume.rb:46:in `action_create'
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/sbi_lvm/recipes/extradisks.rb
    
      2:   lvm_physical_volume disk['device']
      3:   lvm_volume_group disk['vg'] do
    
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/sbi_lvm/recipes/extradisks.rb:2:in `block in from_file'
    
    lvm_physical_volume("/dev/sdb") do
      provider Chef::Provider::LvmPhysicalVolume
      action :create
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :lvm_physical_volume
      cookbook_name "sbi_lvm"
      recipe_name "extradisks"
    end
    
    Platform:
    ---------
    x86_64-linux
@tas50 tas50 added the Type: Bug label Jan 4, 2017
@MarkGibbons
Copy link
Member

MarkGibbons commented Jan 6, 2017

If you can please test the changes to the cookbook in an environment with a private rubygems source that is not rubygems.org and without access to ruby gems.org. So far I'm running into long waits and timeouts.

@kemra102
Copy link
Author

kemra102 commented Jan 9, 2017

@MarkGibbons I can't as we don't have one right now.

A colleague of mine removed the old gems manually and ran Chef again and it worked OK.

It seems there is an issue running uninstall on the old gem as shown here:

1 [root@pgsql001]:[~] ~>  /opt/chef/embedded/bin/gem uninstall di-ruby-lvm-attrib
Remove executables:
	generate_field_data

in addition to the gem? [Yn]  Y
Removing generate_field_data
Successfully uninstalled di-ruby-lvm-attrib-0.0.27

I guess Chef can't hit y so it fails this part?

sanguis pushed a commit to sanguis/lvm that referenced this issue Jun 19, 2017
sous-chefsGH-121

* Uses node['lvm']'['gemsource'] in the two chef_gem resources that
remove gems but hang or fail when rubygems.org is not available.

Signed-off-by: Beauregard, Josh <Josh.Beaureg@gmail.com>
tas50 added a commit that referenced this issue Jun 20, 2017
adding source for the air gaped environment use case
@sanguis
Copy link

sanguis commented Jun 20, 2017

thanks @tas50 whats the release date on this?

@tas50
Copy link
Contributor

tas50 commented Jun 20, 2017

Just pushed it up

@tas50 tas50 closed this as completed Jun 20, 2017
@sanguis
Copy link

sanguis commented Jun 20, 2017

sweet as thanks!

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

4 participants