Skip to content

Commit 51d9883

Browse files
committed
parse yaml into structured fact
1 parent 2c04b38 commit 51d9883

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/facter/infiniband_topology.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# switches, with an additional logical switch that connects the
1717
# leaf switches together.
1818

19+
require 'yaml'
20+
1921
$ibtopology = <<SCRIPT
2022
/usr/sbin/ibnetdiscover | /usr/bin/awk '
2123
BEGIN {
@@ -63,8 +65,8 @@
6365
setcode do
6466
if File.file?('/usr/sbin/ibnetdiscover')
6567
begin
66-
Facter::Core::Execution.execute($ibtopology)
67-
rescue Facter::Core::Execution::ExecutionFailure
68+
YAML.load(Facter::Core::Execution.execute($ibtopology))
69+
rescue
6870
'{}'
6971
end
7072
else

0 commit comments

Comments
 (0)