-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathaccounts_parent_dir.rb
More file actions
43 lines (36 loc) · 1.26 KB
/
accounts_parent_dir.rb
File metadata and controls
43 lines (36 loc) · 1.26 KB
1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This is an autogenerated function, ported from the original legacy version.
# It /should work/ as is, but will not have all the benefits of the modern
# function API. You should see the function docs to learn how to add function
# signatures for type safety and to document this function using puppet-strings.
#
# https://puppet.com/docs/puppet/latest/custom_functions_ruby.html
#
# ---- original file header ----
# frozen_string_literal: true
# ---- original file header ----
#
# @summary
# Return directory from path to file
#
#
Puppet::Functions.create_function(:'accounts::accounts_parent_dir') do
# @param args
# The original array of arguments. Port this to individually managed params
# to get the full benefit of the modern function API.
#
# @return [Data type]
# Describe what the function returns here
#
dispatch :default_impl do
# Call the method named 'default_impl' when this is matched
# Port this to match individual params for better type safety
repeated_param 'Any', :args
end
def default_impl(*args)
if args.size != 1
raise(Puppet::ParseError, "accounts_group_members(): Wrong number of args, given #{args.size}, accepts 1")
end
idx = args[0].rindex('/')
return args[0][0...idx]
end
end