Skip to content

Commit

Permalink
ci_build.rb: added snapshot parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Cunnie committed Oct 9, 2012
1 parent 671ec60 commit cc09622
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/ci_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
vmware_cmd=""
vmware_vmx=""
sudo_user=""
snapshot=""

optparse = OptionParser.new do |opts|
opts.banner = "Usage: ci_build.rb options"
Expand All @@ -38,6 +39,9 @@
opts.on("--sudo_user USER", "user to run vmrun as") do |opt|
sudo_user = opt
end
opts.on("--snapshot SNAPSHOT", "snapshot to restore to") do |opt|
snapshot = opt
end
end

optparse.parse!
Expand All @@ -51,8 +55,8 @@

puts "make sure CI guest is running"
system("ssh #{vmware_user_at_host} \"sudo -u #{sudo_user} #{vmware_cmd} start #{vmware_vmx}\"")
puts "reverting CI guest to mostly_pristine snapshot"
system("ssh #{vmware_user_at_host} \"sudo -u #{sudo_user} #{vmware_cmd} revertToSnapshot #{vmware_vmx} mostly_pristine\"") || exit(1)
puts "reverting CI guest to #{snapshot} snapshot"
system("ssh #{vmware_user_at_host} \"sudo -u #{sudo_user} #{vmware_cmd} revertToSnapshot #{vmware_vmx} #{snapshot}\"") || exit(1)
puts "starting CI guest"
system("ssh #{vmware_user_at_host} \"sudo -u #{sudo_user} #{vmware_cmd} start #{vmware_vmx}\"") || exit(1)

Expand Down

0 comments on commit cc09622

Please sign in to comment.