Skip to content

Safe Directory not working as expected #592

Open
@jjarokergc

Description

@jjarokergc

Describe the Bug

The error "Path [...] exists and is not the desired repository" appeared in my puppet logs on a previously-working manifest for the installation of Dokuwiki. That resource is shown here:
https://github.com/jjarokergc/puppet-dokuwiki/blob/61c04b113525a3a10ac3b6c1d91eaa37df36531c/manifests/init.pp#L63

  vcsrepo { $www_root :
    ensure             => 'present',
    provider           => 'git',
    trust_server_cert  => true,
    source             => $code_source[repo][url],
    revision           => $code_source[repo][revision],
    depth              => 1,
    user               => $provisioning[user],
    require            => File[$vhost_dir],
    keep_local_changes => true,
    safe_directory     => true, # Response to CVE-2022-24765
  }

This error appeared after updating git to version 2.25.1 on Ubuntu, which backported the CVE-2022-24765 bug fix, introducing this failure. I followed the discussion and suggestions shown in Issue #535 and added the safe_directory parameter in the above example. I would appreciate any suggestions on how to get this module working again.

Expected Behavior

I was expecting the git update to proceed as before but the "change from 'absent' to 'present' failed" problem persists.

Environment

lsb_release -a

Description:    Ubuntu 20.04.5 LTS
Release:        20.04
Codename:       focal

On client: puppet agent --version
7.23.0

On master: puppetserver --version
puppetserver version: 7.9.5

Puppetfile.r10k
mod 'puppetlabs-vcsrepo', '5.4.0'

Additional Context

puppet agent -t --debug

Debug: Executing: 'git --version'
Debug: Executing: 'git -c http.sslVerify=false config --get remote.origin.url'
Debug: Executing: 'git --version'
Debug: Executing: 'git -c http.sslVerify=false config --global --get-all safe.directory'
Notice: Vcsrepo[/var/www/yurevichi.org/htdocs](provider=git): Adding '/var/www/yurevichi.org/htdocs' to safe directory list
Debug: Executing: 'git --version'
Debug: Executing: 'git -c http.sslVerify=false config --global --add safe.directory /var/www/yurevichi.org/htdocs'
Debug: Executing: 'git --version'
Debug: Executing: 'git -c http.sslVerify=false config --get remote.origin.url'
Error: Path /var/www/yurevichi.org/htdocs exists and is not the desired repository.
Error: /Stage[main]/Dokuwiki/Vcsrepo[/var/www/yurevichi.org/htdocs]/ensure: change from 'absent' to 'present' failed: Path /var/www/yurevichi.org/htdocs exists and is not the desired repository.
Notice: /Stage[main]/Dokuwiki/File[/var/www/yurevichi.org/htdocs/robots.txt]: Dependency Vcsrepo[/var/www/yurevichi.org/htdocs] has failures: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions