def self.rpc_find_one(node_profile=nil)
current_server = nil
additional_filters = []
if Rails.configuration.msg_broker[:node_profile_enabled]
if node_profile
additional_filters.push({:fact => "node_profile",
:value => node_profile,
:operator => "=="})
end
end
options = rpc_options
options[:filter]['fact'] = options[:filter]['fact'] + additional_filters
options[:mcollective_limit_targets] = "1"
rpc_client = rpcclient('rpcutil', :options => options)
begin
rpc_client.get_fact(:fact => 'public_hostname') do |response|
raise OpenShift::NodeException.new("No nodes found. If the problem persists please contact Red Hat support.", 140) unless Integer(response[:body][:statuscode]) == 0
current_server = response[:senderid]
end
ensure
rpc_client.disconnect
end
return current_server
end