Skip to content

Commit 175e8a3

Browse files
committed
Add parameter update_command_path
Add update_command_path parameter that defaults value is the value of $update_command Allows a custom update command to be used that is more than just the path to wrapper script
1 parent d700865 commit 175e8a3

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ The name of the package to install. Default: mlocate
8888

8989
Ensure the package is present, latest, or absent. Default: present
9090

91+
####`update_command_path`
92+
93+
The path of the updatedb wrapper script. Default: $update_command
94+
9195
####`update_command`
9296

9397
The name of the updatedb wrapper script. Default: /usr/local/bin/mlocate.cron

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
# [*package_ensure*]
1111
# Ensure the package is present, latest, or absent. Default: present
1212
#
13+
# [*update_command_path*]
14+
# The path to the updatedb wrapper script. Default: $update_command
15+
#
1316
# [*update_command*]
1417
# The name of the updatedb wrapper script. Default: /usr/local/bin/mlocate.cron
1518
#
@@ -77,6 +80,7 @@
7780
class mlocate (
7881
$package_name = $mlocate::params::package_name,
7982
$package_ensure = $mlocate::params::package_ensure,
83+
$update_command_path = $mlocate::params::update_command_path,
8084
$update_command = $mlocate::params::update_command,
8185
$deploy_update_command = $mlocate::params::deploy_update_command,
8286
$update_on_install = $mlocate::params::update_on_install,
@@ -97,6 +101,8 @@
97101

98102
validate_string($package_name)
99103
validate_re($package_ensure, ['^present', '^latest', '^absent'], "Error: \$package_ensure must be either 'present', 'latest', or 'absent'")
104+
$_update_command_path = pick($update_command_path, $update_command)
105+
validate_absolute_path($_update_command_path)
100106
validate_absolute_path($update_command)
101107
validate_bool($deploy_update_command)
102108
validate_bool($update_on_install)

manifests/install.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
$package_ensure = $::mlocate::package_ensure,
33
$package_name = $::mlocate::package_name,
44
$conf_file = $::mlocate::conf_file,
5+
$update_command_path = $::mlocate::_update_command_path,
56
$update_command = $::mlocate::update_command,
67
$deploy_update_command = $::mlocate::deploy_update_command,
78
$update_on_install = $::mlocate::update_on_install,
@@ -30,7 +31,7 @@
3031
if $deploy_update_command {
3132
file { 'update_command':
3233
ensure => file,
33-
path => $update_command,
34+
path => $update_command_path,
3435
owner => 'root',
3536
group => 'root',
3637
mode => '0555',
@@ -48,7 +49,7 @@
4849
}
4950

5051
if $update_on_install == true {
51-
exec { $update_command:
52+
exec { $update_command_path:
5253
refreshonly => true,
5354
creates => '/var/lib/mlocate/mlocate.db',
5455
subscribe => Package['mlocate'],

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
$package_name = 'mlocate'
44
$package_ensure = 'present'
5+
$update_command_path = undef
56
$update_command = '/usr/local/bin/mlocate.cron'
67
$deploy_update_command = true
78
$update_on_install = true

0 commit comments

Comments
 (0)