diff --git a/bolt-project.yaml b/bolt-project.yaml index e465c37..69d4926 100644 --- a/bolt-project.yaml +++ b/bolt-project.yaml @@ -14,4 +14,3 @@ modules: - name: puppetlabs/stdlib - name: puppetlabs/ruby_task_helper - name: puppet/format - - name: nwops/debug # only needed for debugging plans with `debug::break` diff --git a/dist/puppetsync/functions/record_stage_results.pp b/dist/puppetsync/functions/record_stage_results.pp index d897d6a..dfe697c 100644 --- a/dist/puppetsync/functions/record_stage_results.pp +++ b/dist/puppetsync/functions/record_stage_results.pp @@ -38,8 +38,8 @@ function puppetsync::record_stage_results( } default: { - out::message("+++++++ DEFAULT puppetsync::record_stage_results (\$result = Tuple?)") - debug::break() + # Unrecorded results would let failed targets pass later stages' filters + fail( "puppetsync::record_stage_results('${stage_name}'): cannot record results of unexpected type '${type($results, 'generalized')}'" ) } } } diff --git a/dist/puppetsync/plans/batch.pp b/dist/puppetsync/plans/batch.pp index 7676663..0519db9 100644 --- a/dist/puppetsync/plans/batch.pp +++ b/dist/puppetsync/plans/batch.pp @@ -33,6 +33,5 @@ ctrl::sleep( $delay ) next($result) } - debug::break() return( $results ) } diff --git a/dist/puppetsync/spec/functions/parse_puppetfile_spec.rb b/dist/puppetsync/spec/functions/parse_puppetfile_spec.rb deleted file mode 100644 index fbd2df7..0000000 --- a/dist/puppetsync/spec/functions/parse_puppetfile_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe 'puppetsync::parse_puppetfile' do - let(:pf) do - <<-PF - moduledir 'modules' - - mod 'stdlib', - :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', - :tag => 'v6.2.0' - - mod 'simplib', - :git => 'git@github.com:simp/pupmod-simp-simplib.git', - :tag => '4.2.0' - moduledir '_repos' - - mod 'simp-acpid', - :git => 'https://github.com/simp/pupmod-simp-acpid' - PF - end - - let(:pf_modules_hash) do - {"modules/stdlib"=>{"git"=>"https://github.com/puppetlabs/puppetlabs-stdlib.git", "tag"=>"v6.2.0", "name"=>"stdlib", "rel_path"=>"modules/stdlib", "mod_rel_path"=>"modules/stdlib", "mod_name"=>"stdlib", "install_path"=>"modules", "repo_name"=>"puppetlabs-stdlib"}, "modules/simplib"=>{"git"=>"git@github.com:simp/pupmod-simp-simplib.git", "tag"=>"4.2.0", "name"=>"simplib", "rel_path"=>"modules/simplib", "mod_rel_path"=>"modules/simplib", "mod_name"=>"simplib", "install_path"=>"modules", "repo_name"=>"pupmod-simp-simplib"}, "_repos/simp-acpid"=>{"git"=>"https://github.com/simp/pupmod-simp-acpid", "name"=>"simp-acpid", "rel_path"=>"_repos/simp-acpid", "mod_rel_path"=>"_repos/acpid", "mod_name"=>"acpid", "install_path"=>"_repos", "repo_name"=>"pupmod-simp-acpid"}} - end - - context 'when a simple array is passed' do - it { is_expected.to run.with_params(pf, '.').and_return(pf_modules_hash) } - end -end diff --git a/dist/puppetsync/spec/spec_helper.rb b/dist/puppetsync/spec/spec_helper.rb deleted file mode 100644 index 6cd5e8d..0000000 --- a/dist/puppetsync/spec/spec_helper.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true -RSpec.configure do |c| - c.mock_with :rspec -end -require 'puppetlabs_spec_helper/module_spec_helper' - -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' - -require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) - -include RspecPuppetFacts - -default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version, -} - -default_fact_files = [ - File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), - File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), -] - -default_fact_files.each do |f| - next unless File.exist?(f) && File.readable?(f) && File.size?(f) - - begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e - RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" - end -end - -# read default_facts and merge them over what is provided by facterdb -default_facts.each do |fact, value| - add_custom_fact fact, value -end - -RSpec.configure do |c| - c.default_facts = default_facts - c.before :each do - # set to strictest setting for testing - # by default Puppet runs at warning level - Puppet.settings[:strict] = :warning - end - c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] - c.after(:suite) do - end -end - -# Ensures that a module is defined -# @param module_name Name of the module -def ensure_module_defined(module_name) - module_name.split('::').reduce(Object) do |last_module, next_module| - last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) - last_module.const_get(next_module, false) - end -end - -# 'spec_overrides' from sync.yml will appear below this line