File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
lib/facter/custom_facts/util Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2121 - ' 2.3'
2222 - ' 2.7'
2323 - ' 3.0'
24+ - ' 3.1'
2425 - ' jruby'
2526 runs-on : ubuntu-18.04
2627 steps :
Original file line number Diff line number Diff line change @@ -70,7 +70,11 @@ def parse_results
7070 def parse_executable_output ( output )
7171 res = nil
7272 begin
73- res = YAML . safe_load ( output , [ Symbol , Time ] )
73+ res = if Gem ::Version . new ( Psych ::VERSION ) >= Gem ::Version . new ( '3.1.0' ) # Ruby 2.6+
74+ YAML . safe_load ( output , permitted_classes : [ Symbol , Time ] )
75+ else
76+ YAML . safe_load ( output , [ Symbol , Time ] )
77+ end
7478 rescue StandardError => e
7579 Facter . debug ( "Could not parse executable fact output as YAML or JSON (#{ e . message } )" )
7680 end
@@ -114,7 +118,11 @@ def parse_results
114118 # Add quotes to Yaml time
115119 cont = content . gsub ( TIME , '"\1"' )
116120
117- YAML . safe_load ( cont , [ Date ] )
121+ if Gem ::Version . new ( Psych ::VERSION ) >= Gem ::Version . new ( '3.1.0' ) # Ruby 2.6+
122+ YAML . safe_load ( cont , permitted_classes : [ Date ] )
123+ else
124+ YAML . safe_load ( cont , [ Date ] )
125+ end
118126 end
119127 end
120128
You can’t perform that action at this time.
0 commit comments