Ask Your Question

How to enable Puppet's debug logging level from Beaker

asked 2015-11-08 10:21:32 -0500

pgp.ornl gravatar image

I have some beaker-rspec acceptance tests covering a module I am creating, and would like to know how to enable debug logging on the underlying Puppet calls (e.g., know exactly what happens when I call apply_manifest). I'm pretty sure I've been been able to get debug logging working on Beaker itself (export BEAKER_debug=yes?), but that only seems to tell me what Beaker is doing, not necessarily Puppet.

If it helps, here are some relevant file snippets:


require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'
require 'beaker/librarian'

RSpec.configure do |c|
  module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

  c.formatter = :documentation

  # Configure all nodes in nodeset
  c.before :suite do
    librarian_install_modules(module_root, 'mymodule')


require 'spec_helper_acceptance'

apply_manifest_opts = {
  :catch_failures => true,
  # I seem to need this otherwise Puppet doesn't pick up the required modules.
  # Is this where I can also enable debug logging in Puppet? 
  :modulepath     => '/etc/puppetlabs/puppet/modules/',

default_pp = <<-EOS
  class { 'mymodule': }

describe 'the mymodule class' do
  describe 'given default params' do
    it 'should return successfully' do
      expect(apply_manifest(default_pp, apply_manifest_opts).exit_code).to be_zero

I'm actually trying to work out why the the mymodule class given default params should return successfully test fails, but at the moment I only get

Failure/Error: expect(apply_manifest(default_pp, apply_manifest_opts).exit_code).to be_zero
       expected `` to return true, got false

which is not much help. Do you see my problem?

I'll accept responses that either answer my question directly, or give me some other way to work out why the exit code is non-zero.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-11-11 15:22:08 -0500

pgp.ornl gravatar image

I was right on my hunch that it just needed an extra option supplied to apply_manifest. It just took me a while to work out exactly where the documentation was on how to do it.

apply_manifest_opts = {
  :catch_failures => true,
  # I seem to need this otherwise Puppet doesn't pick up the required modules. 
  :modulepath     => '/etc/puppetlabs/puppet/modules/',
  :debug          => true,


edit flag offensive delete link more

answered 2017-11-08 05:50:18 -0500

updated 2017-11-08 10:39:01 -0500

DarylW gravatar image

Since this came up as the top hit for enabling debugging in Beaker, I thought I would provide an updated answer...

I'm not sure if this is a valid option anymore. "apply_manifests_opts" didn't even retrieve a Google hit. Try this instead:


export BEAKER_debug="true"

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-11-08 10:21:32 -0500

Seen: 1,092 times

Last updated: Nov 08 '17