From 3887173c2c3a9feb3ed4a67fccc330d5ebe3ff8f Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Thu, 2 Jul 2015 15:41:12 -0700 Subject: [PATCH] Use cfacter instead of facter if possible CFacter is the facter replacement written in C++. It is available from the puppetlabs repo. --- lib/ansible/module_utils/facts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index aedd028b242..7b95d2e65dd 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2734,12 +2734,16 @@ def get_all_facts(module): for (k, v) in facts.items(): setup_options["ansible_%s" % k.replace('-', '_')] = v - # Look for the path to the facter and ohai binary and set + # Look for the path to the facter, cfacter, and ohai binaries and set # the variable to that path. facter_path = module.get_bin_path('facter') + cfacter_path = module.get_bin_path('cfacter') ohai_path = module.get_bin_path('ohai') + # Prefer to use cfacter if available + if cfacter_path is not None: + facter_path = cfacter_path # if facter is installed, and we can use --json because # ruby-json is ALSO installed, include facter data in the JSON