lib/cuken/api/vagrant/common.rb in cuken-0.1.13 vs lib/cuken/api/vagrant/common.rb in cuken-0.1.15
- old
+ new
@@ -18,11 +18,12 @@
module Api
module Vagrant
module Common
def establish_vm_interactive_ssh(boxname)
- cmd = vagrant.vm[boxname.to_sym].ssh.ssh_connect_command
+ name = vagrant.vm.key?(:primary) ? :primary : boxname.to_sym
+ cmd = vagrant.vm[name].ssh.ssh_connect_command
run_interactive(unescape(cmd))
end
def load_vagrant_file(path, expect_presence = true)
vagrant.path = Pathname(path).expand_path.realdirpath
@@ -39,11 +40,11 @@
if expect_presence
load_vagrant_file(path)
end
end
else
- in_current_dir do
+ in_dir do
if expect_presence
load_vagrant_file(path)
end
end
end
@@ -66,13 +67,15 @@
end
def check_vm_state(name, state, expect_state = true )
in_chef_root do
if expect_state
+ # puts vagrant.status(name).inspect
vagrant.vm[name.to_sym].vm.state.should == state
else
- vagrant.vm[name.to_sym].vm.state.should_not == state
- end
+ puts vagrant.status(name).inspect
+ vagrant.status(name).include?(state).should be_false
+ end
end
end
def run_vm_manager_command(cmd, vm_name, vm_manager = :vagrant)
method(vm_manager).call.send(cmd, vm_name)