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
7 changes: 5 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ fixtures:
forge_modules:
stdlib:
repo: 'puppetlabs/stdlib'
ref: '4.3.2'
ref: '4.13.1'
systemd:
repo: 'camptocamp/systemd'
ref: '2.6.0'
symlinks:
"mlocate": "#{source_dir}"
mlocate: "#{source_dir}"
4 changes: 4 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
spec/spec_helper.rb:
mock_with: ':rspec'
hiera_config: "'spec/fixtures/hiera.yaml'"
53 changes: 16 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
language: ruby
cache: bundler
bundler_args: --without development system_tests
before_install: rm Gemfile.lock || true
script: bundle exec rake test
before_install:
- rm -f Gemfile.lock || true
script:
- 'bundle exec rake $CHECK'
sudo: false
rvm:
- 1.9.3
- 2.0.0
- 2.1.0

env:
- PUPPET_VERSION="~> 3.4.0"
- PUPPET_VERSION="~> 3.5.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 4.1.0"
- PUPPET_VERSION="~> 4.2.0"
- PUPPET_VERSION="~> 4.3.0"

matrix:
exclude:
- rvm: 1.9.3
env: PUPPET_VERSION="~> 4.0.0"
- rvm: 1.9.3
env: PUPPET_VERSION="~> 4.1.0"
- rvm: 1.9.3
env: PUPPET_VERSION="~> 4.2.0"
- rvm: 1.9.3
env: PUPPET_VERSION="~> 4.3.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 4.0.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 4.1.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 4.2.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 4.3.0"
- rvm: 2.1.0
env: PUPPET_VERSION="~> 3.4.0"
fast_finish: true
include:
- rvm: 2.1.9
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.10" CHECK=test
- rvm: 2.4.4
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 5.6" CHECK=test
- rvm: 2.5.1
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 6.1" CHECK=rubocop
notifications:
email:
- [email protected]
Expand Down
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ source "https://rubygems.org"

group :test do
gem 'rake'
gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.8.0'
gem 'rspec-puppet', git: 'https://github.com/rodjek/rspec-puppet.git'
gem 'puppet', ENV['PUPPET_VERSION']
gem 'rspec-puppet'
gem 'puppetlabs_spec_helper'
gem 'metadata-json-lint', '~> 1.0.0' if RUBY_VERSION < '2.0.0'
gem 'metadata-json-lint' if RUBY_VERSION >= '2.0.0'
gem 'metadata-json-lint'
gem 'rspec-puppet-facts'
gem 'rspec-puppet-utils'
gem 'rspec'
gem 'puppet-blacksmith'
gem 'rubocop', '~> 0.39.0' if RUBY_VERSION < '2.0.0'
gem 'rubocop' if RUBY_VERSION >= '2.0.0'
gem 'rubocop'
gem 'rubocop-rspec'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-trailing_comma-check'
gem 'puppet-lint-version_comparison-check'
gem 'puppet-lint-classes_and_types_beginning_with_digits-check'
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'json_pure', '~> 1.x'
gem 'json_pure'
end

group :development do
Expand Down
113 changes: 61 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build Status](https://travis-ci.org/adamcrews/puppet-mlocate.svg)](https://travis-ci.org/adamcrews/puppet-mlocate)
[![Puppet Forge](http://img.shields.io/puppetforge/v/adamcrews/mlocate.svg)](http://forge.puppetlabs.com/adamcrews/mlocate)
[![License (Apache 2.0)](https://img.shields.io/badge/license-Apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)

#### Table of Contents

Expand All @@ -23,7 +24,6 @@
7. [Contributors](#contributors)

## Overview

Install and manage the mlocate/updatedb package.

## Module Description
Expand All @@ -48,7 +48,7 @@ Everything can be configured via the default mlocate class.

## Usage

Basic usage that will result is a setup very close to a default CentOS configuration
Basic usage that will result is a setup very close to a default RedHat configuration

```puppet
include ::mlocate
Expand All @@ -72,83 +72,93 @@ class { '::mlocate':

#### Private Classes

* mlocate::params: default parameters.
* mlocate::install: install and configure the software.
* mlocate::cron: setup the cron job.
* mlocate::cron: setup the cron job or systemd timer.

###Parameters
### Parameters

The following parameters are available as options to the default mlocate class.

####`package_name`

The name of the package to install. Default: mlocate

####`package_ensure`

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

####`update_command`

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

####`update_on_install`

Run an initial update when the package is installed. Default: true
#### `package_name`
The name of the package to install.
**Default: 'mlocate'**

####`conf_file`
#### `package_ensure`
Ensure the package is 'present', 'absent', or 'latest'.
**Default: 'present'**

The configuration file for updatedb. Default: /etc/updatedb.conf
#### `update_command`
The name of the updatedb wrapper script.
**Default: '/usr/local/bin/mlocate.cron'**

####`cron_ensure`
#### `update_on_install`
Run an initial update when the package is installed.
**Default: true**

Ensure the cron jobs is present or absent. Default: present
#### `conf_file`
The configuration file for updatedb.
**Default: '/etc/updatedb.conf'**

####`cron_schedule`
#### `cron_method`
Set to 'cron' on RHEL 6 and 7 and to 'timer' on RHEL 8
**Default: 'timer' (depending on OS version)**

The standard cron time schedule. Default: once a week based on fqdn_rand
#### `cron_ensure`
Ensure the cron jobs is present or absent.
**Default: 'present'**

####`cron_daily_path`
#### `cron_schedule`
The standard cron time schedule.
**Default: once a week based on *fqdn_rand* **

The path to cron.daily file installed by mlocate and that is removed
#### `timer_schedule`
The standard timer OnCalendar schedule.
**Default: once a week **

####`prune_bind_mounts`
#### `cron_daily_path`
The path to cron.daily file installed by mlocate and that is removed.
**Default: '/etc/cron.daily/mlocate.cron' or '/etc/cron.daily/mlocate' (depending on OS version)**

Prune out bind mounts or not. Default: yes
#### `prune_bind_mounts`
Prune out bind mounts or not.
*Optional value*
**Default: 'yes'**
Refer to the updatedb.conf man page for more detail.
On redhat 5 systems defaults to none.

####`prunenames`

Prune out directories matching this pattern. Default: .git .hg .svn
#### `prunenames`
Prune out directories matching this pattern.
*Optional value*
**Default: '.git .hg .svn'**
Refer to the updatedb.conf man page for more detail.
On redhat 5 systems defaults to none.

####`extra_prunenames`

Prune out additional directories matching this pattern. Default: none
#### `extra_prunenames`
Prune out additional directories matching this pattern.
*Optional value*
**Default: undef**

####`prunefs`

Prune out these FS types. Default: refer to the params.pp
#### `prunefs`
Prune out these filesystem types.
**Default: refer to `mlocate::prunefs` in *data/common.yaml* **
Refer to the updatedb.conf man page for more detail.

####`extra_prunefs`

Prune out additional directories matching this pattern. Default: none
#### `extra_prunefs`
Prune out additional filesystem types matching this pattern.
*Optional value*
**Default: undef**

####`prunepaths`

Prune out paths matching this pattern. Default: refer to params.pp
#### `prunepaths`
Prune out paths matching this pattern.
**Default: refer to `mlocate::prunepaths` in *data/common.yaml* **
Refer to the updatedb.conf man page for more detail.

####`extra_prunepaths`

Prune out additional directories matching this pattern. Default: none
#### `extra_prunepaths`
Prune out additional paths matching this pattern.
*Optional value*
**Default: undef**

## Limitations

This has only been tested on CentOS 6.5, but should work fine on any RHEL based system, versions 4+
This has only been tested on CentOS 6 and RedHat 6/7, but should work fine on any supported RHEL-based system.

## Development

Expand All @@ -165,4 +175,3 @@ With the 0.3.0 release, the cron job times will likely change as an extra seed a
## Contributors

Contributors can be found on github.

20 changes: 7 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet/version'
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
require 'rubygems'
require 'bundler/setup'

require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet/version'
require 'puppetlabs_spec_helper/rake_tasks'

# These gems aren't always present, for instance
# on Travis with --without development
Expand All @@ -14,14 +16,10 @@ end
Rake::Task[:lint].clear

PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true

# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')

exclude_paths = [
Expand All @@ -43,14 +41,10 @@ task :contributors do
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
end

task :metadata do
sh "metadata-json-lint metadata.json"
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
:metadata,
:metadata_lint,
]
3 changes: 3 additions & 0 deletions data/RedHat_6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
mlocate::cron_daily_path: '/etc/cron.daily/mlocate.cron'
mlocate::cron_method: 'cron'
3 changes: 3 additions & 0 deletions data/RedHat_7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
mlocate::cron_daily_path: '/etc/cron.daily/mlocate'
mlocate::cron_method: 'cron'
2 changes: 2 additions & 0 deletions data/RedHat_8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
mlocate::cron_daily_path: ~
Loading