mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
Merge pull request #979 from chef/vj/train-conn-out-of-loop
move train connection out of loop for command_simulator
This commit is contained in:
commit
67a0aa5bc8
1 changed files with 5 additions and 3 deletions
|
@ -3,13 +3,13 @@ require 'train'
|
|||
|
||||
commands = { 'inspec_exec' => 'inspec exec examples/profile/controls/example.rb', 'inspec_version' => 'inspec version' }
|
||||
|
||||
backend = Train.create('local')
|
||||
conn = backend.connection
|
||||
|
||||
commands.each do |keyname, command|
|
||||
backend = Train.create('local')
|
||||
conn = backend.connection
|
||||
# loop around commands
|
||||
cmd = conn.run_command(command)
|
||||
cmd.stdout
|
||||
conn.close
|
||||
|
||||
# save the result and put it in inspec/www/app/results with the keyname as filename
|
||||
result = cmd.stdout
|
||||
|
@ -18,3 +18,5 @@ commands.each do |keyname, command|
|
|||
out_file.puts(result)
|
||||
out_file.close
|
||||
end
|
||||
|
||||
conn.close
|
||||
|
|
Loading…
Reference in a new issue