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

gem not running as rvm user? #8951

Closed
ouiea opened this issue Dec 2, 2013 · 7 comments
Closed

gem not running as rvm user? #8951

ouiea opened this issue Dec 2, 2013 · 7 comments
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists

Comments

@ouiea
Copy link
Contributor

ouiea commented Dec 2, 2013

I'm having an issue trying to install rvm and unicorn, am I missing something?

I'm getting this error on the minion's log (it's running 0.17.2):

2013-12-02 19:56:14,444 [salt.loaded.int.module.cmdmod][INFO ] Executing command 'gem list unicorn' as user 'rvm' in directory '/home/rvm'
2013-12-02 19:56:14,557 [salt.loaded.int.module.cmdmod][ERROR ] Command 'gem list unicorn' failed with return code: 127
2013-12-02 19:56:14,558 [salt.loaded.int.module.cmdmod][ERROR ] stderr: /bin/sh: 1: gem: not found
2013-12-02 19:56:14,678 [salt.loaded.int.module.cmdmod][INFO ] Executing command 'gem install unicorn --no-rdoc --no-ri' as user 'rvm' in directory '/home/rvm'
2013-12-02 19:56:14,790 [salt.loaded.int.module.cmdmod][ERROR ] Command 'gem install unicorn --no-rdoc --no-ri' failed with return code: 127
2013-12-02 19:56:14,791 [salt.loaded.int.module.cmdmod][ERROR ] stderr: /bin/sh: 1: gem: not found

My unicorn.sls:
unicorn:
gem.installed:
- user: rvm
- runas: rvm
- ruby: ruby-1.9.3
- rdoc: False
- ri: False
- require:
- sls: rvm

My rvm.sls:
rvm:
group:
- present
user.present:
- fullname: rvm
- shell: /bin/bash
- home: /home/rvm
- gid: rvm
- require:
- group: rvm

rvm-deps:
pkg.installed:
- names:
- bash
- coreutils
- gzip
- bzip2
- gawk
- sed
- curl
- git-core
- subversion

mri-deps:
pkg.installed:
- names:
- build-essential
- openssl
- libreadline6
- libreadline6-dev
- curl
- git-core
- zlib1g
- zlib1g-dev
- libssl-dev
- libyaml-dev
- libsqlite3-0
- libsqlite3-dev
- sqlite3
- libxml2-dev
- libxslt1-dev
- autoconf
- libc6-dev
- libncurses5-dev
- automake
- libtool
- bison
- subversion
- ruby

ruby-1.9.3:
rvm.installed:
- default: True
- user: rvm
- require:
- pkg: rvm-deps
- pkg: mri-deps
- user: rvm

mygemset:
rvm.gemset_present:
- ruby: ruby-1.9.3
- user: rvm
- require:
- rvm: ruby-1.9.3

On the minion, if I su as rvm and run:
gem list unicorn
works. Of course it I run it as root it doesn't.
Am I missing something here?

Thanks!

@ouiea
Copy link
Contributor Author

ouiea commented Dec 2, 2013

I've found it. gem.py (https://github.com/saltstack/salt/blob/develop/salt/modules/gem.py) is calling 'rvm.is_installed' without passing it the user. So if I'm correct Line 16 of that file:

if __salt__['rvm.is_installed']():

Should be

if __salt__['rvm.is_installed'](runas=runas):

I've triead to push my branch to origin following the "send pull request" tutorial here (http://docs.saltstack.com/topics/hacking.html) but seems I don't have push permits. Can anyone fix it please?
Thanks!

@basepi
Copy link
Contributor

basepi commented Dec 3, 2013

Did you fork the repo? You have to have your own fork, then you push your branch to your fork, then open a pull request from that branch.

@basepi
Copy link
Contributor

basepi commented Dec 3, 2013

(We can also make this fix for you, but we love having new contributors and want to give you credit for finding the bug!)

@ouiea
Copy link
Contributor Author

ouiea commented Dec 4, 2013

Hi there, would that do it?
Cheers!

@basepi
Copy link
Contributor

basepi commented Dec 4, 2013

Looks good! Did you submit the pull request?

@basepi
Copy link
Contributor

basepi commented Dec 4, 2013

Ah, found the pull req: #9020. Thanks for doing that!

thatch45 added a commit that referenced this issue Dec 5, 2013
Fixes issue #8951 - gem install fails when rvm is set up with another us...
@ouiea
Copy link
Contributor Author

ouiea commented Dec 11, 2013

Solved with this pull request:
#9020

@ouiea ouiea closed this as completed Dec 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests

2 participants