Skip to content

Commit

Permalink
Fix #318: Introducing custom uninstall in sensu_gem
Browse files Browse the repository at this point in the history
sensu_gem inherits the methods from its parent, gem.rb.
The uninstall method in gem.rb contains a bug that prevents the right
gem command from being issued. (/usr/bin/gem uninstall -x -a
sensu-plugin is executed instead of /opt/sensu/embedded/bin/gem
uninstall -x -a sensu-plugin).

Issue PUP-4191 has been raised in the puppet project and PR #3708 has
been opened in puppetlabs/puppet.

As temporary workaround, we should overwrite the gem.rb uninstall
method to use the execute function, which then issues the right gem
command.
  • Loading branch information
queeno committed Mar 12, 2015
1 parent 800e208 commit dbd0c41
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/puppet/provider/package/sensu_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@
has_feature :versionable, :install_options

commands :gemcmd => "/opt/sensu/embedded/bin/gem"

def uninstall
command = [command(:gemcmd), "uninstall"]
command << "-x" << "-a" << resource[:name]
output = execute(command)

# Apparently some stupid gem versions don't exit non-0 on failure
self.fail "Could not uninstall: #{output.chomp}" if output.include?("ERROR")
end

end

0 comments on commit dbd0c41

Please sign in to comment.