From 49e9d29280ce23f72eba0df84aeb4f870368f189 Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Tue, 17 Jul 2018 13:18:15 +0200 Subject: [PATCH] Simplify the mkdir --- lib/ansible/runner.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/ansible/runner.rb b/lib/ansible/runner.rb index 6bc519951c7..e8d3e66348c 100644 --- a/lib/ansible/runner.rb +++ b/lib/ansible/runner.rb @@ -9,7 +9,7 @@ def run(env_vars, extra_vars, playbook_path) def run_via_cli(env_vars, extra_vars, playbook_path) Dir.mktmpdir("ansible-runner") do |base_dir| - mkdir(base_dir + '/project') # without this, there is a silent fail of the ansible-runner command see https://github.com/ansible/ansible-runner/issues/88 + Dir.mkdir(File.join(base_dir, 'project')) # without this, there is a silent fail of the ansible-runner command see https://github.com/ansible/ansible-runner/issues/88 result = AwesomeSpawn.run!(ansible_command(base_dir), :env => env_vars, :params => [{:cmdline => "--extra-vars '#{JSON.dump(extra_vars)}'", :playbook => playbook_path}]) @@ -21,10 +21,6 @@ def return_code(base_dir) File.read(File.join(base_dir, "artifacts/result/rc")) end - def mkdir(base_dir) - Dir.mkdir(base_dir) unless Dir.exist?(base_dir) - end - def ansible_command(base_dir) # TODO add possibility to use custom path, e.g. from virtualenv "ansible-runner run #{base_dir} --json -i result"