puppet-pacemaker/lib/serverspec/type/pacemaker_colocation.rb
Dmitry Ilyin 4d2e554f68 Merge with fuel-infra/puppet-pacemaker
* Import all providers, specs and tests to this module
* Use corosync module to actually install paceamker

Fuel-CI: disable
Change-Id: I9a16ad1453b694aa0a3e78d079f9c57365a5fcf1
2016-05-25 11:22:22 +02:00

58 lines
1.2 KiB
Ruby

require_relative 'pacemaker_xml'
module Serverspec::Type
# This Serverspec type can do the check on the Pacemaker colocation object
class Pacemaker_colocation < PacemakerXML
# Check if this object is present
# @return [true,false]
def present?
!instance.nil?
end
alias exists? present?
# The data object from the library or nil if there is no object
# @return [Hash,nil]
def instance
constraint_colocations[@name]
end
# The name of the resource which is
# running on the same node as the first one
# @return [Strong,nil]
def rsc
return unless instance
instance['rsc']
end
alias second rsc
# The name of the first resource
# @return [Strong,nil]
def with_rsc
return unless instance
instance['with-rsc']
end
alias first with_rsc
# The priority score value
# @return [String,nil]
def score
return unless instance
instance['score']
end
# Test representation
def to_s
"Pacemaker_colocation #{@name}"
end
end
end
# Define the object creation function
def pacemaker_colocation(*args)
name = args.first
Serverspec::Type::Pacemaker_colocation.new(name)
end