lib/bolt/error.rb in bolt-0.18.0 vs lib/bolt/error.rb in bolt-0.18.1
- old
+ new
@@ -61,6 +61,16 @@
def initialize(*args)
super(*args)
@error_code = 2
end
end
+
+ class PuppetError < Error
+ def self.convert_puppet_errors(result)
+ Bolt::Util.walk_vals(result) { |v| v.is_a?(Puppet::DataTypes::Error) ? from_error(v) : v }
+ end
+
+ def self.from_error(err)
+ new(err.msg, err.kind, err.details, err.issue_code)
+ end
+ end
end