-
Notifications
You must be signed in to change notification settings - Fork 111
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
Shims aren't loaded for noninteractive shells on ubuntu 12.04 #47
Comments
|
Thanks zzet, if I recall any |
@dmitrym0 Sorry, can you explain your question? |
@zzet, I'm trying to provision an environment from an ansible script. Specifically it requires installing ruby 2.2.2 and Phusion Passenger. I have the following statement:
Unfortunately that will run into an issue because it will try to use system ruby (which happens to be 1.9.3 on ubuntu 12.04) because shims aren't loaded for non-interactive shells. As a work around, I'm specifying that sudo needs to be executed with the
I suppose it works fine, but I do have to add this stanza to every |
I am writing here as the other two issues are closed. I see your point in #9240 but the case is that one could setup user shell and only then use It is in fact more error prone to hardcode things that these tools do as if the tool changes, or some version number changes, then strings would need to be updated on a number of places. And it will be very ugly for example to invoke a It is totally ok to warn users when doing something but I can't understand why prevent user do something when it makes sense even if that often doesn't make sense. Stupid user will always find a way to do stupid things. But preventing legitimate use cases is more harmful IMO. P.S. |
came here from ansible/ansible#4854 - to repeat what I said there, I have to wrap my commands in an additional @akostadinov I read your comment a couple times but I'm not sure I understand what you're proposing as a solution. [My comment on 4854] has a more complete example in the context of nodejs/NVM but the issue is exactly the same. I don't actually think this is an issue with rbenv and I think @zzet may be limited as to how much exactly can be solved in this role, vs solving it in either the core |
@thom-nic , good point, I didn't state my proposed solution. In fact I can't think of a common use case where shell profile files are better not loaded. And I can't think of such. If machine was setup by ansible and then maintained by ansible, then shell and profile scripts should be pretty much solid. Is it a common use case to run ansible over some random machine that you are not well aware of it's current setup? I hope not. So the solution IMO is to enable login shell by default and allow disabling that. I'm ok if at least login shell can be enabled somehow (shell module option or sudo directive). |
I agree, but don't know of a good solution to enable login profile by default. The discussion in the ansible issue I linked above has a couple proposed solutions but none that song require a change to ansible core. As I commented on that issue, the best solution I've come up with is to use |
Not saying this is necessarily the right solution, but it's the one I came up with messing with rbenv on my own a while ago, and it's been working fine for me: - name: source rbenv init in non-interactive shells
lineinfile: dest=/etc/bash.bashrc
state=present
regexp='profile.d/rbenv.sh'
insertbefore=BOF
line="source /etc/profile.d/rbenv.sh" |
Non interactive
Interactive
Any tips on fixing this? Basically anything following
rbenv
role in my playbook that relies on correct ruby version (like thegem
role) fails.The text was updated successfully, but these errors were encountered: