0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Miscallenous actions on Puppetfiles
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.14.2
~> 1.13
~> 2.4
~> 0.10.4
~> 10.0
~> 3.0
~> 0.13.0
~> 2.3

Runtime

~> 3.5
~> 0.19.4
 Project Readme

Puppetfiler

Travis CI Code Climate Test Coverage

Gem for miscellaneous actions based on Puppetfiles.

Installation

gem install puppetfiler
gem 'puppetfiler'

Usage

A puppetfile can be specified via -p path/to/pf or --puppetfile path/to/pf, a metadata file via -m path/to/metadata.json or --metadata path/to/metadata.json.

If neither are specified puppetfiler will check for a file named Puppetfile in the current working directory first, then for a file named metadata.json.

check

Check puppet forge for newer versions of used forge modules. For Puppetfiles the currently set version on newest on the forge are compared. For metadata.json puppetfiler checks that the newest version on the forge is covered by the range constraint.

$ puppetfiler check
module               current  newest
puppetlabs/stdlib    4.13.1   4.15.0
puppetlabs/firewall  1.8.1    1.8.2

Be aware that the check command may take a while, since each module has to be queried from the forge.

fixture

Create puppetlabs_spec_helper compatible .fixtures.yml.

$ puppetfiler fixture
$ cat .fixtures.yml
---
fixtures:
  forge_modules:
    stdlib:
      repo: puppetlabs/stdlib
      ref: 4.13.1
    firewall:
      repo: puppetlabs/firewall
      ref: 1.8.1

Gerating .fixture.yml when executing rake tasks

Without modifying the result:

require 'puppetfiler/rake_tasks'

Which adds the task fixture, which is equivalent to runnning puppetfiler fixture.

With modifying the result:

require 'puppetfiler'

desc 'Generate .fixtures.yml'
task :fixture do
    modifier = {
        'forge_modules' => {
            /.*/ => {
                'flags' => '--module_repository https://inhouse.forge.lan/',
            },
        },
    }

    Puppetfiler.fixture(modifier)
end

task :spec => [:fixtures]
task :test do
    [:metadata_lint, :lint, :validate, :spec].each do |test|
        Rake::Task[test].invoke
    end
end

Allowed keys in the passed modifiers are 'forge_modules' and 'repositories', which are hashes with strings or regular expressions as keys and hashes or strings as values.

Also see the rspec test takes a hash with pattern matches and returns fixtures as a hash in spec/puppetfiler/puppetfile_spec.rb.