Permalink
Browse files

Change micro offline/online commands for new MCF.

The new version of MCF uses dnsmasq slightly differently.

The '|| true' will make these commands not fail when pointing at the old
MCF version.

Change-Id: Ia94e788516f8e8632c75b2a9971aa4340d7bf118
  • Loading branch information...
1 parent b3a02ae commit 4d7e05d1ba7afe18cd54e12e78abb5e761e9e616 @mmb mmb committed Oct 16, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/vmc/micro/vmrun.rb
View
@@ -76,12 +76,16 @@ def offline!
path = VMC::Micro.escape_path(VMC::Micro.config_file('offline.conf'))
run('CopyFileFromHostToGuest', "#{path} /etc/dnsmasq.d/offline.conf")
run('runProgramInGuest', '/usr/bin/touch /var/vcap/micro/offline')
+ run('runProgramInGuest',
+ "/bin/sed -i -e 's/^[^#]/# &/g' /etc/dnsmasq.d/server || true")
restart_dnsmasq
end
def online!
run('runProgramInGuest', '/bin/rm -f /etc/dnsmasq.d/offline.conf')
run('runProgramInGuest', '/bin/rm -f /var/vcap/micro/offline')
+ run('runProgramInGuest',
+ "/bin/sed -i -e 's/^# //g' /etc/dnsmasq.d/server || true")
restart_dnsmasq
end
@@ -133,7 +137,13 @@ def running?
vms.map! { |x| x.downcase }
vms.include?(@vmx.downcase)
else
- vms.include?(@vmx)
+ # Handle vmx being in a symlinked dir.
+ real_path = nil
+ begin
+ real_path = File.realpath(@vmx)
+ rescue
+ end
+ vms.include?(@vmx) || (real_path && vms.include?(real_path))
end
end

0 comments on commit 4d7e05d

Please sign in to comment.