Class: VagrantPlugins::ProviderIijGp::Action::VagrantTweaks

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-iijgp/action/vagrant_tweaks.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ VagrantTweaks

Returns a new instance of VagrantTweaks.



5
6
7
8
# File 'lib/vagrant-iijgp/action/vagrant_tweaks.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("vagrant_iijgp::action::vagrant_tweaks")
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/vagrant-iijgp/action/vagrant_tweaks.rb', line 10

def call(env)
  case env[:machine].provider_config.vagrant_tweaks
  when :allow_root_notty_sudo
    env[:machine].communicate.execute(%q[grep "^Defaults:root !requiretty$" /etc/sudoers ||] +
                                      %q[(chmod 600 /etc/sudoers && sed -i.bak 's/^Defaults\s*requiretty/Defaults requiretty\nDefaults:root !requiretty/g' /etc/sudoers; chmod 400 /etc/sudoers)])
  end

  @app.call(env)
end