From f6d7160e4aaecebe9f83087f330b1d6f48ba9e25 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Mon, 10 Feb 2020 15:31:19 -0500 Subject: [PATCH] fix parenthesis in file and dir exists calls --- lib/beaker/dsl/helpers/host_helpers.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/beaker/dsl/helpers/host_helpers.rb b/lib/beaker/dsl/helpers/host_helpers.rb index 42a8ba55a1..04f76dd2ec 100644 --- a/lib/beaker/dsl/helpers/host_helpers.rb +++ b/lib/beaker/dsl/helpers/host_helpers.rb @@ -470,12 +470,12 @@ def backup_the_file host, current_dir, new_dir, filename = 'puppet.conf' # @return [Boolean] Whether the file exists on the host (using `test -f`) def file_exists_on(host, file_path) if host['platform'] =~ /windows/ - command = Command.new(%{IF exist "#{file_path}" exit 0 ELSE exit 1}, [], { :cmdexe => true, :accept_all_exit_codes => true }) + command = Command.new(%{IF exist "#{file_path}" ( exit 0 ) ELSE ( exit 1 )}, [], { :cmdexe => true }) else - command = Command.new(%(test -f "#{file_path}"), [], accept_all_exit_codes: true) + command = Command.new(%(test -f "#{file_path}"), []) end - return on(host, command).exit_code.zero? + return on(host, command, { :accept_all_exit_codes => true}).exit_code.zero? end # Check whether a directory exists on the host @@ -488,12 +488,12 @@ def directory_exists_on(host, dir_path) if host['platform'] =~ /windows/ dir_path = "#{dir_path}\\" unless (dir_path[-1].chr == '\\') - command = Command.new(%{IF exist "#{dir_path}" exit 0 ELSE exit 1}, [], { :cmdexe => true, :accept_all_exit_codes => true }) + command = Command.new(%{IF exist "#{dir_path}" ( exit 0 ) ELSE ( exit 1 )}, [], { :cmdexe => true }) else - command = Command.new(%(test -d "#{dir_path}"), [], accept_all_exit_codes: true) + command = Command.new(%(test -d "#{dir_path}"), []) end - return on(host, command).exit_code.zero? + return on(host, command, { :accept_all_exit_codes => true }).exit_code.zero? end # Check whether a symlink exists on the host