Puppet Function: systemd_escape
- Defined in:
- lib/puppet/parser/functions/systemd_escape.rb
- Function type:
- Ruby 3.x API
Overview
Returns a file system path as escaped by systemd.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet/parser/functions/systemd_escape.rb', line 4 newfunction(:systemd_escape, :type => :rvalue, :doc => <<-EOS Returns a file system path as escaped by systemd. EOS ) do |args| if (args.length != 1) then raise Puppet::ParseError, ("validate_cmd(): wrong number of arguments (#{args.length}; must be 1)") end path = args[0] cmd = "systemd-escape --path #{path}" escaped = Puppet::Util::Execution.execute(cmd) return escaped.strip end |