File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
lib/puppet/parser/functions Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,11 @@ module Puppet::Parser::Functions
24
24
25
25
metadata_exists = File . exists? ( metadata_json ) # rubocop:disable Lint/DeprecatedClassMethods : Changing to .exist? breaks the code
26
26
if metadata_exists
27
- metadata = PSON . load ( File . read ( metadata_json ) )
27
+ metadata = if Puppet ::Util ::Package . versioncmp ( Puppet . version , '8.0.0' ) . negative?
28
+ PSON . load ( File . read ( metadata_json ) )
29
+ else
30
+ JSON . parse ( File . read ( metadata_json ) )
31
+ end
28
32
else
29
33
metadata = { }
30
34
raise ( Puppet ::ParseError , "load_module_metadata(): No metadata.json file for module #{ mod } " ) unless allow_empty_metadata
Original file line number Diff line number Diff line change @@ -49,10 +49,18 @@ module Puppet::Parser::Functions
49
49
warning ( "Can't load '#{ url } ' HTTP Error Code: '#{ res . status [ 0 ] } '" )
50
50
args [ 1 ]
51
51
end
52
- PSON . load ( contents ) || args [ 1 ]
52
+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '8.0.0' ) . negative?
53
+ PSON . load ( contents ) || args [ 1 ]
54
+ else
55
+ JSON . parse ( contents ) || args [ 1 ]
56
+ end
53
57
elsif File . exists? ( args [ 0 ] ) # rubocop:disable Lint/DeprecatedClassMethods : Changing to .exist? breaks the code
54
58
content = File . read ( args [ 0 ] )
55
- PSON . load ( content ) || args [ 1 ]
59
+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '8.0.0' ) . negative?
60
+ PSON . load ( content ) || args [ 1 ]
61
+ else
62
+ JSON . parse ( content ) || args [ 1 ]
63
+ end
56
64
else
57
65
warning ( "Can't load '#{ args [ 0 ] } ' File does not exist!" )
58
66
args [ 1 ]
You can’t perform that action at this time.
0 commit comments