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



107
108
109
# File 'lib/beaker/testmode_switcher/beaker_runners.rb', line 107

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



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/beaker/testmode_switcher/beaker_runners.rb', line 112

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))

  handle_puppet_run_returned_exit_code(get_acceptable_puppet_run_exit_codes(opts), res.exit_code)
  res
end