Class: Beaker::TestmodeSwitcher::BeakerApplyRunner

Inherits:
BeakerRunnerBase show all
Defined in:
lib/beaker/testmode_switcher/beaker_runners.rb

Overview

All functionality specific to running in ‘apply’ mode

Instance Attribute Summary

Attributes inherited from BeakerRunnerBase

#hosts, #logger

Instance Method Summary collapse

Methods inherited from BeakerRunnerBase

#create_remote_file_ex, #initialize, #resource, #scp_to_ex, #shell_ex

Methods inherited from RunnerBase

#get_acceptable_puppet_run_exit_codes, #handle_puppet_run_returned_exit_code

Constructor Details

This class inherits a constructor from Beaker::TestmodeSwitcher::BeakerRunnerBase

Instance Method Details

#execute_manifest(manifest, opts = {}) ⇒ Object

execute the manifest by running puppet apply on the default node



113
114
115
# File 'lib/beaker/testmode_switcher/beaker_runners.rb', line 113

def execute_manifest(manifest, opts = {})
  execute_manifest_on(default, manifest, opts)
end

#execute_manifest_on(hosts, manifest, opts = {}) ⇒ Object

execute the manifest by running puppet apply on all the hosts



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/beaker/testmode_switcher/beaker_runners.rb', line 118

def execute_manifest_on(hosts, manifest, opts = {})
  # acceptable_exit_codes and expect_changes are passed because we want detailed-exit-codes but want to
  # make our own assertions about the responses

  res = apply_manifest_on(
    hosts,
    manifest,
    debug: opts[:debug],
    dry_run: opts[:dry_run],
    environment: opts[:environment] || {},
    noop: opts[:noop],
    trace: opts[:trace],
    expect_failures: true,
    acceptable_exit_codes: (0...256))

  if res.is_a? Array
    res.each do |result|
      handle_puppet_run_returned_exit_code(get_acceptable_puppet_run_exit_codes(opts), result.exit_code)
    end
  else
    handle_puppet_run_returned_exit_code(get_acceptable_puppet_run_exit_codes(opts), res.exit_code)
  end
  res
end