From 56097ac51aa5243c7bf6ac795267645c248e78fe Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Thu, 7 Jan 2021 18:31:30 +0000 Subject: [PATCH] Made manifest default to nil --- README.md | 2 +- features/cache.feature | 2 +- lib/onceover/controlrepo.rb | 9 +++++++-- spec/fixtures/controlrepos/caching/manifests/site.pp | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f74b641..2db08cfb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Onceover is a tool to automatically run basic tests on an entire Puppet control It includes automatic parsing of the `Puppetfile`, `environment.conf` and others in order to stop silly mistakes ever reaching your Puppet Master! -**🍺🥳 New in v3.17.1: Heaps more Windows fixes! Windows code is now more likely to compile on Non-Windows.** +**New in v3.20.0: I've reversed the decision to have onceover use `site.pp` in the same way Puppet does. From now on your `manifest` setting in `environment.conf` will be ignored and your `site.pp` will only be used if you explicitly set the `manifest` option in the CLI or config file.** [![Build Status](https://travis-ci.com/dylanratcliffe/onceover.svg?branch=master)](https://travis-ci.com/dylanratcliffe/onceover) [![Build status](https://ci.appveyor.com/api/projects/status/2ys2ggkgln69hmyf/branch/master?svg=true)](https://ci.appveyor.com/project/dylanratcliffe/onceover/branch/master) diff --git a/features/cache.feature b/features/cache.feature index 7a29a906..1e4f2feb 100644 --- a/features/cache.feature +++ b/features/cache.feature @@ -14,7 +14,7 @@ Feature: Create and maintain a .onceover cache Then the cache should exist And the cache should contain all controlrepo files - Scenario: Runnone onnceover in the caching repo + Scenario: Run onceover in the caching repo Given control repo "caching" When I run onceover command "run spec --classes role::webserver" Then I should not see any errors diff --git a/lib/onceover/controlrepo.rb b/lib/onceover/controlrepo.rb index c5a2de47..b8b0337f 100644 --- a/lib/onceover/controlrepo.rb +++ b/lib/onceover/controlrepo.rb @@ -123,11 +123,16 @@ def initialize(opts = {}) @profile_regex = opts[:profile_regex] ? Regexp.new(opts[:profile_regex]) : /profile[s]?:{2}/ @tempdir = opts[:tempdir] || File.expand_path('./.onceover', @root) $temp_modulepath = nil - manifest = opts[:manifest] || config['manifest'] || 'manifests' - @manifest = File.expand_path(manifest, @root) @opts = opts logger.level = :debug if @opts[:debug] @@existing_controlrepo = self + + # Set the manifest option to the fully expanded path if it's used, + # default to nil + manifest = opts[:manifest] || config['manifest'] || nil + if manifest + @manifest = File.expand_path(manifest, @root) + end end diff --git a/spec/fixtures/controlrepos/caching/manifests/site.pp b/spec/fixtures/controlrepos/caching/manifests/site.pp index 7059c8cd..f0dd6137 100644 --- a/spec/fixtures/controlrepos/caching/manifests/site.pp +++ b/spec/fixtures/controlrepos/caching/manifests/site.pp @@ -29,4 +29,5 @@ # This is where you can declare classes for all nodes. # Example: # class { 'my_class': } + fail('This was using the manifest setting from environment.conf') }