Skip to content

Source recipe fails on subsequent converge if package based install used in between #110

@fletchowns

Description

@fletchowns

Cookbook version

5.0.1

Chef-client version

12.10.24

Platform Details

CentOS 7.2 Bento Box

Scenario:

Converge fails due to error:

mkdir: cannot create directory ‘git-2.6.2’: File exists

Steps to Reproduce:

We're using the git::source recipe to install git 2.6.2 on CentOS 7.2. Initial converge works great, source based install succeeds, and we have git 2.6.2 on the PATH. I think what's happening is that something else in our converge is inadvertently doing a packaged based install of git, and then the next time git::source the guard passes since git --version returns 1.8.3.1, so git::source thinks it needs to install it again. It fails to extract it because the extracted version already exists in Chef::Config['file_cache_path'].

So it's admittedly a bug in our converge that the package based install of git is happening, but it seems like something that this cookbook should be able to recover from.

Here's the relevant chunk from the converge output: https://gist.github.com/fletchowns/cdab5e1f58722fd4d9cd6f4492fa3e52

Expected Result:

It seems like the git::source recipe should be able to handle the output directory in Chef::Config['file_cache_path'] already existing by using a mkdir -p or something instead of just a mkdir.

Actual Result:

The converge fails because the cache directory already exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions