puppet-pacemaker/lib/facter/pacemaker_node_name.rb
Michele Baldessari 447cef0ad8 Silence useless facter errors when calling crm_node
When calling crm_node -n we can drop stderr so that people
are not confused about the following error:

$ crm_node -n
error: Could not connect to cluster (is it running?)
$ crm_node -n 2>/dev/null
$

Change-Id: Ie774ff5862cf5f28f712e009d271055eb5d646d0
2019-09-23 10:32:38 +02:00

11 lines
287 B
Ruby

require 'facter'
# Do not call crm_node -n when running inside a container
if not File.exists?('/.dockerenv') and not File.exists?('/run/.containerenv')
Facter.add('pacemaker_node_name') do
setcode do
Facter::Core::Execution.exec 'crm_node -n 2>/dev/null'
end
end
end