sous-chefs / sous-chefs/git

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

Open
#110 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
125
Forks
170
Avg merge
5h 43m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the git::source recipe and the handling of Chef::Config['file_cache_path']; reproduce on CentOS 7.2 with cookbook 5.0.1 and Chef 12.10.24 using the reported package-install-then-converge sequence. Done means a subsequent converge succeeds when the extracted git-2.6.2 directory already exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, ruby
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.