Skip to content

Commit

Permalink
Merge pull request #112 from tphoney/FM-8094
Browse files Browse the repository at this point in the history
(FM-8094) remove workaround for bolt on windows
  • Loading branch information
florindragos authored May 23, 2019
2 parents d81f2d1 + 00869f5 commit 2fe7bd5
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions lib/puppet_litmus/serverspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,7 @@ def apply_manifest(manifest, opts = {})
command_to_run += " --modulepath #{Dir.pwd}/spec/fixtures/modules" if target_node_name.nil? || target_node_name == 'localhost'
command_to_run += ' --detailed-exitcodes' if !opts[:catch_changes].nil? && (opts[:catch_changes] == true)
command_to_run += ' --debug' if !opts[:debug].nil? && (opts[:debug] == true)
# BOLT-608
if Gem.win_platform?
stdout, stderr, status = Open3.capture3(command_to_run)
status_text = if status.to_i.zero?
'success'
else
'failure'
end
result = [{ 'node' => 'localhost', 'status' => status_text, 'result' => { 'exit_code' => status.to_i, 'stderr' => stderr, 'stdout' => stdout } }]
else
result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)
end
result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)

raise "apply manifest failed\n`#{command_to_run}`\n======\n#{result}" if result.first['result']['exit_code'] != 0 && opts[:expect_failures] != true

Expand All @@ -64,15 +53,15 @@ def apply_manifest(manifest, opts = {})
result
end

# Creates a manifest file locally, if running against localhost create in a temp location. Or create it on the target system.
# Creates a manifest file locally in a temp location, if its a remote target copy it to there.
#
# @param manifest [String] puppet manifest code.
# @return [String] The path to the location of the manifest.
def create_manifest_file(manifest)
require 'tempfile'

require 'tmpdir'
target_node_name = ENV['TARGET_HOST']
manifest_file = Tempfile.new(['manifest_', '.pp'])
tmp_filename = File.join(Dir.tmpdir, "manifest_#{Time.now.strftime('%Y%m%d')}_#{Process.pid}_#{rand(0x100000000).to_s(36)}.pp")
manifest_file = File.open(tmp_filename, 'w')
manifest_file.write(manifest)
manifest_file.close
if target_node_name.nil? || target_node_name == 'localhost'
Expand Down

0 comments on commit 2fe7bd5

Please sign in to comment.