Puppet Function: process_mounts

Defined in:
lib/puppet/parser/functions/process_mounts.rb
Function type:
Ruby 3.x API

Overview

process_mounts()Any

Returns a Payload Hash of properly formatted mounts. Expects Array.

Returns:

  • (Any)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/puppet/parser/functions/process_mounts.rb', line 2

newfunction(:process_mounts, :type => :rvalue, :doc => <<-EOS
Returns a Payload Hash of properly formatted mounts. Expects Array.
  EOS
) do |args|

  if args.size != 1
    e = "process_mounts(): Wrong number of args: #{args.size} for 1"
    raise(Puppet::ParseError, e)
  end

  urls = args[0]

  unless urls.is_a? Array
    e = "process_mounts(): Wrong arg type! (#{urls.class} instead of Array)"
    raise(Puppet::ParseError, e)
  end

  unless urls.empty?
    urls.collect! { |u| Hash['AuthenticateAsLoginUserShortName', true,
      'Hide', false, 'URL', u] }
  end

  Hash['PayloadType', 'com.apple.loginitems.managed',
    'AutoLaunchedApplicationDictionary-managed',
    [urls].flatten
  ]
end