Fix primitive_status for pacemaker

When calling primitive_status using a node param, the status is not
detected properly if the node id in the CIB is not equal to its
hostname. Fixing this by looping through all nodes and checking the
uname key.

Change-Id: Id84994df3bf2a990d2925b595aa448746db45383
This commit is contained in:
Javier Pena 2015-01-23 12:07:41 +01:00
parent d33a87a2cf
commit 908103d89a
1 changed files with 11 additions and 5 deletions

View File

@ -410,11 +410,17 @@ class Puppet::Provider::Pacemaker_common < Puppet::Provider
# @return [String]
def primitive_status(primitive, node = nil)
if node
nodes.
fetch(node, {}).
fetch('primitives',{}).
fetch(primitive, {}).
fetch('status', nil)
found_node = nil
nodes.each do |k, v|
if v.fetch("uname", {}).eql? node
found_node = v
end
end
return unless found_node
found_node.
fetch('primitives',{}).
fetch(primitive, {}).
fetch('status', nil)
else
statuses = []
nodes.each do |k,v|