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

librarian-chef copies all Applications folder on Mac OS X #26

Open
attilagyorffy opened this issue Jan 15, 2014 · 5 comments
Open

librarian-chef copies all Applications folder on Mac OS X #26

attilagyorffy opened this issue Jan 15, 2014 · 5 comments

Comments

@attilagyorffy
Copy link

I know this is weird, but I did not believe with my own eyes, yet this happened.

I have a cookbook in ./cookbooks/eclm-base, the rest of the cookbooks listed in Cheffile are dependencies of that cookbook. My Cheffile looks like this:

#!/usr/bin/env ruby
#^syntax detection

site 'http://community.opscode.com/api/v1'

cookbook 'eclm-base', path: './cookbooks/eclm-base'

cookbook 'postgresql'
cookbook 'rbenv', git: 'https://github.com/fnichol/chef-rbenv.git'

Then do librarian-chef install. Takes bloody ages, then I decided to look into cookbooks/eclm-base and found that Librarian-Chef replaced the contents of that cookbook directory with my Applications. I suspect it would have continued with the rest of my HDD root if I did not stop the process.

@attilagyorffy
Copy link
Author

Also, I am on Mavericks and using the following Ruby version:

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

@ggriffin
Copy link

I ran into this as well using a similar pattern in my Cheffile:

cookbook 'mycookbook',
:path => './cookbooks/mycookbook'

bundle exec librarian-chef install was taking a long time, so I cancelled it.
I looked in ./cookbooks/mycookbook and found an Applications directory with what appears to be a copy of many of my apps, about 2.1GB worth. I think my real Applications directory is intact.

Perhaps this was user error, where the cookbook was originally pulled from a git source into the cookbooks directory. I made edits to it thinking I could change the Cheffile to reference it with :path and then ran librarian-chef install. After further reading, I believe librarian-chef uses the cookbook directory to store cookbooks referenced in the Cheffile. So I'm not surprised bad things happened here, but I'm not sure why it started to copy / to the directory.

I'm running Mac OS X Lion 10.7.5 (11G63)

@enmartinson
Copy link

Although YMMV, I had this problem as well, and it was because the cookbook that was being referenced was empty. We had some starter cookbooks that are referenced (and copied), but when empty OSX for some reason will copy /Applications instead. Go figure.

Make sure any local files referenced in Cheffile are actually there, and re-run librarian-chef to see if that makes a difference. This process should only take a few minutes, if it seems to hang on a specific cookbook for more than a minute or two I'd check to make sure it doesn't have some local files in there.

@SkyWriter
Copy link

I've put a couple of breakpoints, and it looks like Librarian wipes the recipe before trying to install it when it resides in its cookbooks folder. Then when it comes to copying, it fails to resolve the paths and falls back to '/', consequently duplicating the whole HDD.

The workaround for me was to move the recipe somewhere else, e.g.:

cookbook 'sky-develop', :path => 'site-cookbooks/sky-develop'

@agoddard
Copy link

agoddard commented Dec 9, 2014

What @SkyWriter said, although it seems like accidentally putting cookbooks in cookbooks would be a common mistake, perhaps catching that and failing before trying to resolve makes some sense, duplicating the whole filesystem could run people into trouble..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants