puppetlabs / puppetlabs-vcsrepo

Support for source control repositories
http://forge.puppetlabs.com/puppetlabs/vcsrepo
GNU General Public License v2.0
223 stars 284 forks source link

(GH-585/CONT-998) Fix for safe_directory logic #605

Closed david22swan closed 1 year ago

david22swan commented 1 year ago

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.

In addition: safe directory is now set at a system wide level rather than at a global user level in order to ensure it is as effective as possible.

pmcmaw commented 1 year ago

Can we get some sort of test on this logic please? 😄

david22swan commented 1 year ago

There already is one that should have caught this. Not sure why it didn't

david22swan commented 1 year ago

Test added/updated

hdeadman commented 1 year ago

Doing this at system level is a problem when running puppet as non-root, which I am doing in a container. Non-root users can't write to /etc/gitconfig. I will see if I can create that file in the containers /etc folder to be writable. - Update: I had to make /etc/ directory in the container writable by my non-root user, making the gitconfig file writable wasn't enough.