Skip to content

Commit cdcddf2

Browse files
author
shimon
committed
adding types
1 parent 2420cb6 commit cdcddf2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

manifests/init.pp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,32 @@
55
# Parameters: $user is the useraccount on the machine for which the netrc shall be configured,
66
# $machine_user_password_triples is an array of arrays containing three string params: machine, user, password
77
# $root_home_directory (optional) is the directory where all user homes are located on the target machine, default value is "/home"
8-
#
8+
# $file_path (optional) is the absolute path of the .netrc file.
99
# Actions:
1010
#
1111
# Requires:
1212
#
1313
# Sample Usage: netrc::foruser("netrc_myuser": user => 'myuser', machine_user_password_triples => [['myserver.localdomain','myuser','pw'],['mysecondserver.localdomain','myuser','pw2']])
14-
# you can also override the path using the `file_path` parameter.
14+
# you can also override the full path by using the `file_path` parameter.
1515
# [Remember: No empty lines between comments and class definition]
1616
class netrc {
1717

1818
}
1919

2020
define netrc::foruser(
21-
Enum["present", "absent"] $ensure = "present",
22-
$home_base_directory = "/home",
23-
$user,
24-
$filename = ".netrc",
25-
$file_path = "$home_base_directory/$user/$filename",
21+
Enum["present", "absent"] $ensure = "present",
22+
Stdlib::Absolutepath $home_base_directory = "/home",
23+
String $user,
24+
String $filename = ".netrc",
25+
Optional[Stdlib::Abolutepath] $file_path = "$home_base_directory/$user/$filename",
2626
$machine_user_password_triples) {
2727

28+
$real_file_path = $file_path ? {
29+
undef => "$home_base_directory/$user/$filename",
30+
default => $file_path
31+
}
2832

29-
file { "$file_path":
33+
file { "$real_file_path":
3034
ensure => $ensure,
3135
content => template('netrc/netrc.erb'),
3236
mode => '0600',

0 commit comments

Comments
 (0)