Sha256: 3d0cf22510f47709ad239c1417a7d046deb70fa77aae381d5f6fc9a3bf444957
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'log4r' module VagrantPlugins module Rimu module Actions class SetupSudo def initialize(app, env) @app = app @machine = env[:machine] @logger = Log4r::Logger.new('vagrant::rimu::setup_sudo') end def call(env) # check if setup is enabled return @app.call(env) unless @machine.provider_config.setup? # override ssh username to root user = @machine.config.ssh.username @machine.config.ssh.username = 'root' # check for guest name available in Vagrant 1.2 first guest_name = @machine.guest.name if @machine.guest.respond_to?(:name) guest_name ||= @machine.guest.to_s.downcase case guest_name when /redhat/ env[:ui].info I18n.t('vagrant_rimu.modifying_sudo') # disable tty requirement for sudo @machine.communicate.execute(<<-'BASH') sed -i'.bk' -e 's/\(Defaults\s\+requiretty\)/# \1/' /etc/sudoers BASH end # reset ssh username @machine.config.ssh.username = user @app.call(env) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-rimu-0.0.2 | lib/vagrant-rimu/actions/setup_sudo.rb |
vagrant-rimu-0.0.1 | lib/vagrant-rimu/actions/setup_sudo.rb |