Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ The name of the package to install. Default: mlocate

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

####`update_command_path`

The path of the updatedb wrapper script. Default: $update_command

####`update_command`

The name of the updatedb wrapper script. Default: /usr/local/bin/mlocate.cron
Expand Down
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# [*package_ensure*]
# Ensure the package is present, latest, or absent. Default: present
#
# [*update_command_path*]
# The path to the updatedb wrapper script. Default: $update_command
#
# [*update_command*]
# The name of the updatedb wrapper script. Default: /usr/local/bin/mlocate.cron
#
Expand Down Expand Up @@ -77,6 +80,7 @@
class mlocate (
$package_name = $mlocate::params::package_name,
$package_ensure = $mlocate::params::package_ensure,
$update_command_path = $mlocate::params::update_command_path,
$update_command = $mlocate::params::update_command,
$deploy_update_command = $mlocate::params::deploy_update_command,
$update_on_install = $mlocate::params::update_on_install,
Expand All @@ -97,6 +101,8 @@

validate_string($package_name)
validate_re($package_ensure, ['^present', '^latest', '^absent'], "Error: \$package_ensure must be either 'present', 'latest', or 'absent'")
$_update_command_path = pick($update_command_path, $update_command)
validate_absolute_path($_update_command_path)
validate_absolute_path($update_command)
validate_bool($deploy_update_command)
validate_bool($update_on_install)
Expand Down
5 changes: 3 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
$package_ensure = $::mlocate::package_ensure,
$package_name = $::mlocate::package_name,
$conf_file = $::mlocate::conf_file,
$update_command_path = $::mlocate::_update_command_path,
$update_command = $::mlocate::update_command,
$deploy_update_command = $::mlocate::deploy_update_command,
$update_on_install = $::mlocate::update_on_install,
Expand Down Expand Up @@ -30,7 +31,7 @@
if $deploy_update_command {
file { 'update_command':
ensure => file,
path => $update_command,
path => $update_command_path,
owner => 'root',
group => 'root',
mode => '0555',
Expand All @@ -48,7 +49,7 @@
}

if $update_on_install == true {
exec { $update_command:
exec { $update_command_path:
refreshonly => true,
creates => '/var/lib/mlocate/mlocate.db',
subscribe => Package['mlocate'],
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

$package_name = 'mlocate'
$package_ensure = 'present'
$update_command_path = undef
$update_command = '/usr/local/bin/mlocate.cron'
$deploy_update_command = true
$update_on_install = true
Expand Down