Skip to content

Commit

Permalink
(puppetlabsGH-585/CONT-998) Fix for safe_directory logic
Browse files Browse the repository at this point in the history
Due to  mistake in the logic unsafe directory was previously removed on every other run.
The logic previously checked whether the unsafe directory needed to be added, removing it if this was false without taking into account when it was already set but we wanted it to be left in place.
  • Loading branch information
david22swan authored and LadyNamedLaura committed Oct 31, 2023
1 parent 55e3153 commit 9c12b97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/puppet/provider/vcsrepo/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def update_safe_directory

if should_add_safe_directory?
add_safe_directory
else
elsif should_remove_safe_directory?
remove_safe_directory
end
end
Expand Down Expand Up @@ -657,6 +657,12 @@ def should_add_safe_directory?
!safe_directories.include?(@resource.value(:path)) # directory should not already be in the list
end

# @!visibility private
def should_remove_safe_directory?
!@resource.value(:safe_directory) && # safe_directory should be false
safe_directories.include?(@resource.value(:path)) # directory should be in the list
end

# @!visibility private
def git_remote_action(*args)
proxy = @resource.value(:http_proxy)
Expand Down

0 comments on commit 9c12b97

Please sign in to comment.