Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange safe_directory behavior #585

Closed
krissik opened this issue Jan 5, 2023 · 3 comments
Closed

strange safe_directory behavior #585

krissik opened this issue Jan 5, 2023 · 3 comments

Comments

@krissik
Copy link

krissik commented Jan 5, 2023

Describe the Bug

I have set safe_directory => True.
If I run puppet it is set as expected but on the next run it is unset again. On another server the directory is always append to .gitconfig so /root/.gitconfig looks like that

[safe]
        directory = /opt/myrepo
        directory = /opt/myrepo
        directory = /opt/myrepo

Expected Behavior

Directory of repository is added to "safe" paragraph at .gitconfig if it is not present and not removed.

Steps to Reproduce

This is how I use vcsrepo

 vcsrepo { $deployment_dir:
        ensure         => latest,
        provider       => git,
        safe_directory => true,
        source         => $buildout_repo,
        revision       => $repo_deployment_branch,
        owner          => $buildout_user,
        group          => $buildout_user,
        excludes       => ['parts', 'bin'],
    }

Environment

  • Version 5.3.0
  • Platform Debian 10
@krissik
Copy link
Author

krissik commented Jan 5, 2023

Despite poor ruby knowledge I guess that the case "directory is already in safe_directory list" is missing at

https://github.com/puppetlabs/puppetlabs-vcsrepo/blob/main/lib/puppet/provider/vcsrepo/git.rb#L630

b/c should_add_save_directory returns false if directory is already in safe_directory list and so remove_safe_directory is called.

david22swan added a commit to david22swan/puppetlabs-vcsrepo that referenced this issue May 19, 2023
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.
david22swan added a commit to david22swan/puppetlabs-vcsrepo that referenced this issue May 19, 2023
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.
david22swan added a commit to david22swan/puppetlabs-vcsrepo that referenced this issue May 19, 2023
…stem level

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.
david22swan added a commit to david22swan/puppetlabs-vcsrepo that referenced this issue May 19, 2023
…stem level

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.
@david22swan
Copy link
Member

Fix for this is up: #605

LukasAud added a commit that referenced this issue May 19, 2023
…_directoryfix

(GH-585/CONT-998) Fix for safe_directory logic
@david22swan
Copy link
Member

Release with fix for this has gone out: v6.0.1
Feel free to reopen if it persists

LadyNamedLaura pushed a commit to UGent-DICT/puppetlabs-vcsrepo that referenced this issue Oct 31, 2023
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.
LadyNamedLaura pushed a commit to UGent-DICT/puppetlabs-vcsrepo that referenced this issue Oct 31, 2023
…stem level

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants