Skip to content

Commit

Permalink
package: Use alias to access poise reverse options
Browse files Browse the repository at this point in the history
  • Loading branch information
legal90 committed Jan 17, 2017
1 parent f5fd001 commit bcad7fc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions libraries/consul_installation_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class ConsulInstallationPackage < Chef::Provider
provides(:package)
inversion_attribute 'consul'

# The built-in resource "package" has it's own attribute named "options",
# so we should use an alias to access Poise inversion options.
alias res_options options

# Set the default inversion options.
# @return [Hash]
# @api private
Expand All @@ -35,19 +39,19 @@ def self.default_inversion_options(node, resource)

def action_create
notifying_block do
package options[:package_name] do
source options[:package_source]
version options[:version]
package res_options[:package_name] do
source res_options[:package_source]
version res_options[:version]
action :upgrade
end
end
end

def action_remove
notifying_block do
package options[:package_name] do
source options[:package_source]
version options[:version]
package res_options[:package_name] do
source res_options[:package_source]
version res_options[:version]
action :remove
end
end
Expand Down

0 comments on commit bcad7fc

Please sign in to comment.