Skip to content

Commit

Permalink
Added failure-timeout metaparam
Browse files Browse the repository at this point in the history
  • Loading branch information
rodjek committed May 16, 2010
1 parent 2e84d4a commit 64782b9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/puppet/provider/ha_crm_primitive/crm.rb
Expand Up @@ -110,4 +110,22 @@ def migration_threshold=(value)
crm_resource "-m", "-r", resource[:id], "-p", "migration-threshold", "-v", value.to_s
end
end

def failure_timeout
cib = REXML::Document.new File.open("/var/lib/heartbeat/crm/cib.xml")
nvpair = REXML::XPath.first(cib, "//cib/configuration/resources/primitive[@id='#{resource[:id]}']/meta_attributes/nvpair[@name='failure-timeout']")
if nvpair.nil?
:absent
else
nvpair.attribute(:value).value
end
end

def failure_timeout=(value)
if value == "0"
crm_resource "-m", "-r", resource[:id], "-d", "failure-timeout"
else
crm_resource "-m", "-r", resource[:id], "-p", "failure-timeout", "-v", value.to_s
end
end
end
9 changes: 9 additions & 0 deletions lib/puppet/type/ha_crm_primitive.rb
Expand Up @@ -62,6 +62,15 @@
defaultto "0"
end

newproperty(:failure_timeout) do
desc "How many seconds to wait before acting as if the failure had
not occurred (and potentially allowing the resource back to the
node on which it failed."

newvalues(/\d+/)
defaultto "0"
end

validate do
raise Puppet::Error, "You must specify a class for this primitive" unless @parameters.include?(:class)
raise Puppet::Error, "You must specify a type for this primitive" unless @parameters.include?(:type)
Expand Down

0 comments on commit 64782b9

Please sign in to comment.