Class: VMCMicro::Switcher::Darwin
- Defined in:
- lib/mcf-vmc-plugin/micro/switcher/darwin.rb
Instance Method Summary collapse
- #adminrun(command) ⇒ Object
- #set_nameserver(domain, ip) ⇒ Object
- #unset_nameserver(domain, ip) ⇒ Object
Methods inherited from Base
#domain, #initialize, #ip, #nat?, #offline!, #offline?, #online!, #ready?, #reset_to_nat!, #running?, #set_host_dns!, #start!, #unset_host_dns!, #vmx
Constructor Details
This class inherits a constructor from VMCMicro::Switcher::Base
Instance Method Details
#adminrun(command) ⇒ Object
6 7 8 |
# File 'lib/mcf-vmc-plugin/micro/switcher/darwin.rb', line 6 def adminrun(command) VMCMicro.run_command("osascript", "-e 'do shell script \"#{command}\" with administrator privileges'") end |
#set_nameserver(domain, ip) ⇒ Object
10 11 12 13 |
# File 'lib/mcf-vmc-plugin/micro/switcher/darwin.rb', line 10 def set_nameserver(domain, ip) File.open("/tmp/#{domain}", 'w') { |file| file.write("nameserver #{ip}") } adminrun("mkdir -p /etc/resolver;mv /tmp/#{domain} /etc/resolver/") end |