Class: Vagrant::LXC::SudoWrapper
- Inherits:
-
Object
- Object
- Vagrant::LXC::SudoWrapper
- Includes:
- Util::Retryable
- Defined in:
- lib/vagrant-lxc/sudo_wrapper.rb
Instance Attribute Summary collapse
-
#wrapper_path ⇒ Object
readonly
Returns the value of attribute wrapper_path.
Instance Method Summary collapse
-
#initialize(wrapper_path = nil) ⇒ SudoWrapper
constructor
A new instance of SudoWrapper.
- #run(*command) ⇒ Object
Constructor Details
#initialize(wrapper_path = nil) ⇒ SudoWrapper
Returns a new instance of SudoWrapper.
9 10 11 12 |
# File 'lib/vagrant-lxc/sudo_wrapper.rb', line 9 def initialize(wrapper_path = nil) @wrapper_path = wrapper_path @logger = Log4r::Logger.new("vagrant::lxc::sudo_wrapper") end |
Instance Attribute Details
#wrapper_path ⇒ Object (readonly)
Returns the value of attribute wrapper_path.
7 8 9 |
# File 'lib/vagrant-lxc/sudo_wrapper.rb', line 7 def wrapper_path @wrapper_path end |
Instance Method Details
#run(*command) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/vagrant-lxc/sudo_wrapper.rb', line 14 def run(*command) = command.last.is_a?(Hash) ? command.last : {} if @wrapper_path && ![:no_wrapper] command.unshift @wrapper_path execute *(['sudo'] + command) else execute *(['sudo', '/usr/bin/env'] + command) end end |