Module: BoltSpec::Plans
- Includes:
- BoltContext
- Defined in:
- lib/bolt_spec/plans.rb,
lib/bolt_spec/plans/action_stubs.rb,
lib/bolt_spec/plans/publish_stub.rb,
lib/bolt_spec/plans/mock_executor.rb,
lib/bolt_spec/plans/action_stubs/task_stub.rb,
lib/bolt_spec/plans/action_stubs/script_stub.rb,
lib/bolt_spec/plans/action_stubs/upload_stub.rb,
lib/bolt_spec/plans/action_stubs/command_stub.rb
Defined Under Namespace
Classes: ActionDouble, ActionStub, CommandStub, MockExecutor, MockPuppetDBClient, PublishStub, ScriptStub, TaskStub, UnexpectedInvocation, UploadStub
Constant Summary
collapse
- MOCKED_ACTIONS =
%i[command script task upload].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#allow_out_message, #config, #executor, #expect_out_message, #in_bolt_context, #inventory, #inventory_data, #modulepath, #pal, #plugins, #setup
Class Method Details
.init ⇒ Object
144
145
146
147
148
149
150
151
152
|
# File 'lib/bolt_spec/plans.rb', line 144
def self.init
Bolt::PAL.load_puppet
Puppet[:tasks] = true
Logging.init :debug, :info, :notice, :warn, :error, :fatal, :any
end
|
Instance Method Details
#allow_apply ⇒ Object
189
190
191
192
|
# File 'lib/bolt_spec/plans.rb', line 189
def allow_apply
executor.stub_apply
nil
end
|
#allow_apply_prep ⇒ Object
184
185
186
187
|
# File 'lib/bolt_spec/plans.rb', line 184
def allow_apply_prep
allow_task('apply_helpers::custom_facts')
nil
end
|
#allow_get_resources ⇒ Object
194
195
196
197
|
# File 'lib/bolt_spec/plans.rb', line 194
def allow_get_resources
allow_task('apply_helpers::query_resources')
nil
end
|
#puppetdb_client ⇒ Object
#run_plan(name, params) ⇒ Object
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
# File 'lib/bolt_spec/plans.rb', line 167
def run_plan(name, params)
pal = Bolt::PAL.new(config.modulepath, config.hiera_config, config.boltdir.resource_types)
result = pal.run_plan(name, params, executor, inventory, puppetdb_client)
if executor.error_message
raise executor.error_message
end
begin
executor.assert_call_expectations
rescue StandardError => e
raise "#{e.message}\nPlan result: #{result}"
end
result
end
|