Skip to content

Gem::FilePermissionError when using gem_install_uninstall module #113

Description

@gunnarmarten

Hi,
I'm getting this file permission error when i try to install a gem during capistrano deployment.
The deployment target is a vagrant VM running OpenSuse 13.2.

executing "/usr/local/rvm/bin/rvm ruby-2.2.3@mt_agent do gem install bundler"
servers: ["127.0.0.1"]
[127.0.0.1:2222] executing command
*** [err :: 127.0.0.1:2222] ERROR:  While executing gem ... (Gem::FilePermissionError)
*** [err :: 127.0.0.1:2222] You don't have write permissions for the /usr/local/rvm/gems/ruby-2.2.3@mt_agent directory.

The file permissions are as follows:
drwxrwsr-x 10 root rvm 4096 Dez 10 11:04 ruby-2.2.3@mt_agent
The deployment user is in the rvm group.

My deploy.rb looks like this (excerpt):


set :rvm_type, :system
require "rvm/capistrano"
require "rvm/capistrano/gem_install_uninstall"


set :user,          ENV['DEPLOYMENT_USER'] || 'deployment'
set :use_sudo,      true
set :environment,   'production'

ENV['GEM'] = "bundler"
after 'deploy:update_code',     'bundle:install'
before 'bundle:install', 'rvm:install_gem' # bundler is no more installed as default gem, make sure we have bundler

I did use cap rvm:install_ruby to install ruby and the gemset.

I googled a bit and look at the code. I ended up adding :with_rvm_group => true to the install_gem/uninstall_gem rvm task in the gem_install_uninstall module as in the create_gemset module to avoid the issue.
Is that a proper fix for this issue? Should I submit a PR? Or is that intended that the rvm_group option is missing in the install_gem task?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions