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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 58

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

  run_remote provisioner.install_command
  run_remote provisioner.init_command

  sandbox_path = provisioner.sandbox_path
  root_path = provisioner[:root_path]

  debug("Uploading #{sandbox_path} to #{root_path} through WinRM")
  run "vagrant winrm-upload -c '#{sandbox_path}' '#{root_path}'"

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

#create(state) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 47

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

#destroy(state) ⇒ Object



89
90
91
92
93
94
95
96
97
98
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 89

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



105
106
107
108
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 105

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

#setup(state) ⇒ Object



78
79
80
81
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 78

def setup(state)
  create_vagrantfile
  run_remote busser.setup_cmd
end

#verify(state) ⇒ Object



83
84
85
86
87
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 83

def verify(state)
  create_vagrantfile
  run_remote busser.sync_cmd
  run_remote busser.run_cmd
end

#verify_dependenciesObject



100
101
102
103
# File 'lib/kitchen/driver/vagrant_winrm.rb', line 100

def verify_dependencies
  check_vagrant_version
  check_vagrant_winrm_version
end