[chef] Multiple actions in an LWRP


Chronological Thread 
  • From: Alex Kiernan < >
  • To:
  • Subject: [chef] Multiple actions in an LWRP
  • Date: Tue, 22 Nov 2011 09:37:38 +0000

I've built an LWRP for the RedHat alternatives, picking out a couple
of the actions it looks like this:

action :install do
  execute "alternatives-install-#{new_resource.name}" do
    command = "/usr/sbin/alternatives --install"
    command << " \"#{new_resource.link}\""
    command << " \"#{new_resource.link_group}\""
    command << " \"#{new_resource.path}\""
    command << " \"#{new_resource.priority}\""
    new_resource.slaves.each do |s|
      command << " --slave \"#{s[:link]}\" \"#{s[:name]}\" \"#{s[:path]}\""
    end
    command command
  end
end

action :set do
  execute "alternatives-set-#{new_resource.name}" do
    command = "/usr/sbin/alternatives --set"
    command << " \"#{new_resource.link_group}\" \"#{new_resource.path}\""
    command command
  end
end

How do I make it work so you can invoke two actions from a single
instance of the resource? If I do

action [:install, :set]

inside a recipe, the set never seems to happen?

-- 
Alex Kiernan



Archive powered by MHonArc 2.6.16.

§