Closed MartyEwings closed 2 years ago
Did @jarretlavallee leave a comment earlier about using Facter::Core::Execution.execute()
, or am I imagining that?
I did, but I am not sure where it went. The main thing is just to rescue the exception thrown so it doesn't show a failure. Facter::Core::Execution.execute
makes that easy and standardizes the shell calls.
@jarretlavallee @m0dular I switched to facter core, it captures the exception by default, i didn't see any value it it returning a string, because true or false would be mis leading if its not able to determine it
Facter::Core::Execution.execute will raise a Facter::Core::Execution::ExecutionFailure on failure by default. The :on_fail
option can be used, but you would have to parse the string to see that failure.
@jarretlavallee @m0dular this what you mean? it give the following output if execution fails
[root@pe-node-c17718-1 user]# mv /sbin/ss /tmp/
[root@pe-node-c17718-1 user]# facter -p agent_status_check
[2022-04-04 16:39:49.397300 ] WARN Facter - pe_status_check.AS002 failed to get socket status
{
AS001 => true,
AS002 => false
}
This Commit adds AS002 -
Determines if the pxp-agent has an established connection to a pxp broker
. This fact can also be used as a target filter for running tasks, ensuring time is not wasted sending instructions to agents not connected to a broker