Class: Kitchen::Driver::VagrantWinrm

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/driver/vagrant_winrm.rb

Overview

VagrantWinrm driver for Kitchen.

Author:

Instance Method Summary collapse

Instance Method Details

#converge(state) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 48

def converge(state)
  create_vagrantfile
  provisioner = instance.provisioner
  provisioner.create_sandbox

  run_remote provisioner.install_command
  run_remote provisioner.init_command

  Dir.glob("#{provisioner.sandbox_path}/*").each do |file|
    upload file, File.join(provisioner[:root_path], File.basename(file))
  end

  run_remote provisioner.prepare_command
  run_remote provisioner.run_command
ensure
  provisioner && provisioner.cleanup_sandbox
end

#create(state) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 38

def create(state)
  create_vagrantfile
  run_pre_create_command
  cmd = 'vagrant up --no-provision'
  cmd += " --provider=#{config[:provider]}" if config[:provider]
  run cmd
  info("Vagrant instance #{instance.to_str} created.")
  state[:created] = true
end

#destroy(state) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 77

def destroy(state)
  return unless state[:created]

  create_vagrantfile
  @vagrantfile_created = false
  run 'vagrant destroy -f'
  FileUtils.rm_rf(vagrant_root)
  info("Vagrant instance #{instance.to_str} destroyed.")
  state.delete(:created)
end

#instance=(instance) ⇒ Object



92
93
94
95
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 92

def instance=(instance)
  @instance = instance
  resolve_config!
end

#setup(state) ⇒ Object



66
67
68
69
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 66

def setup(state)
  create_vagrantfile
  run_remote busser_setup_cmd
end

#verify(state) ⇒ Object



71
72
73
74
75
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 71

def verify(state)
  create_vagrantfile
  run_remote busser_sync_cmd
  run_remote busser_run_cmd
end

#verify_dependenciesObject



88
89
90
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 88

def verify_dependencies
  check_vagrant_version
end