Skip to content

Commit

Permalink
Replace PSON parsing with JSON parsing as PSON is deprecated in Puppet 8
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorrea authored and kenyon committed Sep 16, 2023
1 parent d2a5ce4 commit 2c6dda6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/package/npm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def self.npmlist
Puppet.debug("Warning: npm list --json exited with code #{output.exitstatus}") if output.exitstatus != 0
begin
# ignore any npm output lines to be a bit more robust
output = PSON.parse(output.lines.select { |l| l =~ %r{^((?!^npm).*)$} }.join("\n"), max_nesting: 100)
output = JSON.parse(output.lines.select { |l| l =~ %r{^((?!^npm).*)$} }.join("\n"), max_nesting: 100)
@npmlist = output['dependencies'] || {}
rescue PSON::ParserError => e
rescue JSON::ParserError => e
Puppet.debug("Error: npm list --json command error #{e.message}")
@npmlist = {}
end
Expand Down

0 comments on commit 2c6dda6

Please sign in to comment.