-
Notifications
You must be signed in to change notification settings - Fork 170
bundle install requires sudo / root password or --path? #148
Comments
It seems that if I set This is the behavior I want / expect. Wondering what that breaks though. |
Chef achieves this by overriding those ENV variables with these before running a command. Here is how they look like:
I'm curious about the reason why you are going towards using a Gemfile especially in the non-power user scenario. One of the things we're trying to get to is to remove the need to use the Gemfiles when one is working with / around Chef. Can you share your use case maybe we're missing something bigger 😄 |
@sersut Not sure what you are asking? Many tools (and even cookbooks for testing) and such have the first step of using them is to say "bundle install" . I think just about anyone would be doing that pretty often. But now that I think about it, is there any reason to just chown /opt/chefdk to my userid (or something similar for the group)? |
chown'ing /opt/chefdk, using sudo or giving it a password will make bundle install the new gems into The problem with using Gemfiles with Chef DK is that the tools that come with Chef DK will not adhere to the gem versioning overrides in the Gemfiles. The binaries are modified to lock down the gems they are going to use to the gem versions that are shipped with Chef DK. Going back to your previous question, I don't know of a way to install gems with bundle install into |
I'd consider it a bundler bug. We customize rubygems to default to "user" installs, which I think bundler should respect. In my investigation for #146 I learned that bundler seems to have its own implementation for gem installation, which does not always work the way rubygems expects it to. I think the bundler and rubygems teams may be working together to have bundler reuse the rubygems installation code, which might fix the problem. Poking around the issues on bundler, it seems to be their position that rubygems configuration shouldn't affect bundler, e.g., rubygems/bundler#2565 and rubygems/bundler#2667 and rubygems/bundler#710 . In any case there are some workarounds referenced in those tickets. Since we can't globally configure bundler for you, you will probably have to pick a workaround to use for now. You can file an issue with them and see if they're open to providing some configuration mechanism we could set globally ahead of time, even if they're unwilling to honor gemrc and similar. I also found this issue, which says that sudo detection is broken on OS X 10.9: rubygems/bundler#3061 but it's not very informative. |
As a point of feedback I've now tried to help two Chef Novices with no Ruby installed on their system other than the system ruby try to install chef dk and its not been pleasant. The getchef website process is very confusing. They couldn't find the Che DK downloader (UX issues). Once removing the standard chef installer that they accidently downloaded and installed because the website is so confusing, and found Chef-DK, The install goes smoothly. And then we hit the bundler problem. Isn't it kind of common to have Gemfiles in the top level Chef repo for supporting any other code? If the beginner follows the instructions to do a I didn't quite get what the work arounds are for the bundler issue that @danielsdeleo mentioned. |
@rberger generally installing gems to the omnibus bundle should work, but you are probably going to hit this rubygems bug: #146 Probably your best workaround is to create a bundler config in your home directory to set the path option to Finally, it's our long term goal that your day-to-day work shouldn't require bundler at all, but it's going to take a bit of work to get to that point. |
So remind me why I can't just set GEM_HOME= Ie. instead of
Be the same but have That seems to make chef-dk work the way I want/expect. I can use direnv to use pure Chef-DK in cookbooks / repos I'm doing chef work. When I use bunder it still knows and uses any official Chef Gems in Otherwise it trys to put the new gems from the bundle into So bottom line, any reason NOT to set |
That seems workable to me. The code is pretty simple, so it shouldn't be a difficult pull request, if you're up for it. |
I created a pull request #160. As I noted. It works for me but I am not clear what potential impact it could have for others. |
Closing this since #160 was merged. It'll be in 0.3.0 |
CHEF-5208: Omnibus RPM doesn't create symlinks on upgrade
Ok I'm trying Chef-DK again with the assumption that I should recommend this for clients who don't have any other Ruby setup at a minimum and I see that Chef-DK is becoming a requirement for other tools. I've removed all my rvm stuff from my environment so I can pretend to be a new user with no special ruby setup. This is on Mac OS X 10.9.4.
My path and such:
If I do gem install install as a normal user it all works very nicely (seems to put them in
/Users/rberger/.chefdk/gem/ruby/2.1.0/gems
)but if I do a
bundle install
I get:Is there a way not to have to do the --path vendor/bundle, sudo or give it a password?
The text was updated successfully, but these errors were encountered: