Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #612 from ripienaar/611
Browse files Browse the repository at this point in the history
(#611) fail gracefully when modulepath is unset
  • Loading branch information
ripienaar committed Nov 27, 2019
2 parents 214f0fa + 09362e2 commit 5aa8edd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/mcollective/application/playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,29 @@ def pre_parse_find_playbook
# @return [Util::BoltSupport::PlanRunner]
def runner(plan, loglevel=nil)
require "mcollective/util/bolt_support"
runner = Util::BoltSupport::PlanRunner.new(
plan_runner = Util::BoltSupport::PlanRunner.new(
plan,
configuration[:__tmpdir],
configuration[:__modulepath],
configuration[:__loglevel] || "info"
)

unless runner.exist?
unless plan_runner.exist?
STDERR.puts("Cannot find supplied Playbook %s" % plan)
STDERR.puts
STDERR.puts("Module Path:")
STDERR.puts
STDERR.puts(Util.align_text(configuration[:__modulepath].split(":").join("\n")))

if configuration[:__modulepath]
STDERR.puts(Util.align_text(configuration[:__modulepath].split(":").join("\n")))
else
STDERR.puts(Util.align_text("Puppet Default"))
end

exit(1)
end

runner
plan_runner
end

# Adds the playbook inputs as CLI options before starting the app
Expand Down

0 comments on commit 5aa8edd

Please sign in to comment.