File: fail.rb

package info (click to toggle)
puppet-agent 8.10.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,404 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (13 lines) | stat: -rw-r--r-- 352 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

Puppet::Parser::Functions.newfunction(
  :fail,
  :arity => -1,
  :doc => <<~DOC
    Fail with a parse error. Any parameters will be stringified,
    concatenated, and passed to the exception-handler.
  DOC
) do |vals|
  vals = vals.collect(&:to_s).join(" ") if vals.is_a? Array
  raise Puppet::ParseError, vals.to_s
end