Method: Mccloud::Provider::Core::VmCommand#sudo_string

Defined in:
lib/mccloud/provider/core/vm/ssh.rb

#sudo_string(command = nil, options = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mccloud/provider/core/vm/ssh.rb', line 45

def sudo_string(command=nil,options={})
  prefix="sudo -E "

  # Check if we override the user in the options
  unless options[:user]
    prefix="" if self.user == "root"
  else
    prefix="" if options[:user] == "root"
  end
  return "#{prefix}#{command}"
end