Skip to content

Commit 5609b0f

Browse files
authored
Merge pull request #1 from ShimonOhayon/add_file_path_override
Add file path override
2 parents db3fa38 + 48a5442 commit 5609b0f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

manifests/init.pp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
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-
#
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-
$machine_user_password_triples) {
25-
26-
$filename = ".netrc"
21+
Enum["present", "absent"] $ensure = "present",
22+
Stdlib::Absolutepath $home_base_directory = "/home",
23+
String $user,
24+
String $filename = ".netrc",
25+
Stdlib::Absolutepath $file_path = "$home_base_directory/$user/$filename",
26+
Array $machine_user_password_triples) {
2727

28-
file { "$home_base_directory/$user/$filename":
29-
ensure => $ensure,
28+
file { $file_path:
29+
ensure => $ensure,
3030
content => template('netrc/netrc.erb'),
31-
mode => '0600',
32-
owner => "$user"
31+
mode => '0600',
32+
owner => "$user"
3333
}
3434
}

0 commit comments

Comments
 (0)