diff --git a/libraries/recipe_helpers.rb b/libraries/recipe_helpers.rb index db72c646..6062e6f3 100644 --- a/libraries/recipe_helpers.rb +++ b/libraries/recipe_helpers.rb @@ -195,7 +195,7 @@ def must_reinstall?(node) include Chef::Mixin::ShellOut def agent_get_version - return nil unless File.exist?(WIN_BIN_PATH) + return nil unless File.file?(WIN_BIN_PATH) shell_out("\"#{WIN_BIN_PATH}\" version -n").stdout.strip end @@ -203,7 +203,7 @@ def fetch_current_version raw_version = agent_get_version return nil if raw_version.nil? match_data = raw_version.match(/^Agent ([^\s]*) (- Meta: ([^\s]*) )?- Commit/) - + # will fail if raw_version is empty (agent_get_version cmd fails) version = match_data[1] if match_data nightly_version = match_data[3] if match_data[2] # If the Meta tag is catched, we'll add it to the version to specify the nightly version we're using