Module: VagrantPlugins::ESXi::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-vmware-esxi/action.rb,
lib/vagrant-vmware-esxi/action/boot.rb,
lib/vagrant-vmware-esxi/action/halt.rb,
lib/vagrant-vmware-esxi/action/resume.rb,
lib/vagrant-vmware-esxi/action/address.rb,
lib/vagrant-vmware-esxi/action/destroy.rb,
lib/vagrant-vmware-esxi/action/package.rb,
lib/vagrant-vmware-esxi/action/suspend.rb,
lib/vagrant-vmware-esxi/action/createvm.rb,
lib/vagrant-vmware-esxi/action/shutdown.rb,
lib/vagrant-vmware-esxi/action/read_state.rb,
lib/vagrant-vmware-esxi/action/esxi_password.rb,
lib/vagrant-vmware-esxi/action/read_ssh_info.rb,
lib/vagrant-vmware-esxi/action/snapshot_info.rb,
lib/vagrant-vmware-esxi/action/snapshot_list.rb,
lib/vagrant-vmware-esxi/action/snapshot_save.rb,
lib/vagrant-vmware-esxi/action/set_network_ip.rb,
lib/vagrant-vmware-esxi/action/wait_for_state.rb,
lib/vagrant-vmware-esxi/action/snapshot_delete.rb,
lib/vagrant-vmware-esxi/action/snapshot_restore.rb

Overview

actions and how to run them

Defined Under Namespace

Classes: Address, Boot, CreateVM, Destroy, Halt, Package, ReadSSHInfo, ReadState, Resume, SetESXiPassword, SetNetworkIP, Shutdown, SnapshotDelete, SnapshotInfo, SnapshotList, SnapshotRestore, SnapshotSave, Suspend, WaitForState

Class Method Summary collapse

Class Method Details

.action_addressObject



86
87
88
89
90
91
# File 'lib/vagrant-vmware-esxi/action.rb', line 86

def self.action_address
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Address, false
  end
end

.action_address_multiObject



92
93
94
95
96
97
# File 'lib/vagrant-vmware-esxi/action.rb', line 92

def self.action_address_multi
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Address, true
  end
end

.action_destroyObject



136
137
138
139
140
141
142
143
144
145
# File 'lib/vagrant-vmware-esxi/action.rb', line 136

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Call, ReadState do |env1, b1|
      b1.use Halt unless env1[:machine_state] == 'powered_off'
      b1.use ReadState
      b1.use Destroy
    end
  end
end

.action_haltObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vagrant-vmware-esxi/action.rb', line 23

def self.action_halt
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Call, ReadState do |env1, b1|
      if env1[:machine_state].to_s == 'running'
        b1.use Shutdown
        b1.use Call, WaitForState, :powered_off, 30 do |env1, b2|
          b2.use Halt unless env1[:result] == 'True'
        end
      else
        b1.use Halt
      end
    end
  end
end

.action_packageObject



195
196
197
198
199
200
201
# File 'lib/vagrant-vmware-esxi/action.rb', line 195

def self.action_package
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadState
    b.use Package
  end
end

.action_provisionObject



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/vagrant-vmware-esxi/action.rb', line 179

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadState
    b.use Call, WaitForState, :running, 240 do |env1, b1|
      if env1[:result] == 'True'
        b1.use ReadState
        b1.use Provision
        b1.use SyncedFolderCleanup
        b1.use SyncedFolders
        b1.use SetHostname
      end
    end
  end
end

.action_read_ssh_infoObject



16
17
18
19
20
21
# File 'lib/vagrant-vmware-esxi/action.rb', line 16

def self.action_read_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadSSHInfo
  end
end

.action_read_stateObject



9
10
11
12
13
14
# File 'lib/vagrant-vmware-esxi/action.rb', line 9

def self.action_read_state
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadState
  end
end

.action_reloadObject



147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/vagrant-vmware-esxi/action.rb', line 147

def self.action_reload
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Call, ReadState do |env1, b1|
      if (env1[:machine_state].to_s == 'powered_on') ||
         (env1[:machine_state].to_s == 'running') ||
         (env1[:machine_state].to_s == 'suspended')
        b1.use action_halt
      end
      b1.use action_up
    end
  end
end

.action_resumeObject



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/vagrant-vmware-esxi/action.rb', line 47

def self.action_resume
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Call, ReadState do |env1, b1|
      if env1[:machine_state].to_s == 'not_created'
        b1.use Resume
      else
        b1.use Resume
        b1.use WaitForState, :running, 240
      end
    end
  end
end

.action_snapshot_deleteObject



128
129
130
131
132
133
# File 'lib/vagrant-vmware-esxi/action.rb', line 128

def self.action_snapshot_delete
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use SnapshotDelete
  end
end

.action_snapshot_infoObject



99
100
101
102
103
104
# File 'lib/vagrant-vmware-esxi/action.rb', line 99

def self.action_snapshot_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use SnapshotInfo
  end
end

.action_snapshot_listObject



79
80
81
82
83
84
# File 'lib/vagrant-vmware-esxi/action.rb', line 79

def self.action_snapshot_list
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use SnapshotList
  end
end

.action_snapshot_restoreObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/vagrant-vmware-esxi/action.rb', line 113

def self.action_snapshot_restore
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use Halt
    b.use Call, WaitForState, :powered_off, 240 do |env1, b1|
      if env1[:result] == 'True'
        b1.use SnapshotRestore
        b1.use ReadState
        b1.use Boot
        b1.use WaitForState, :running, 240
      end
    end
  end
end

.action_snapshot_saveObject



106
107
108
109
110
111
# File 'lib/vagrant-vmware-esxi/action.rb', line 106

def self.action_snapshot_save
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use SnapshotSave
  end
end

.action_sshObject



61
62
63
64
65
66
67
68
# File 'lib/vagrant-vmware-esxi/action.rb', line 61

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadState
    b.use ReadSSHInfo
    b.use SSHExec
  end
end

.action_ssh_runObject



70
71
72
73
74
75
76
77
# File 'lib/vagrant-vmware-esxi/action.rb', line 70

def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadState
    b.use ReadSSHInfo
    b.use SSHRun
  end
end

.action_suspendObject



39
40
41
42
43
44
45
# File 'lib/vagrant-vmware-esxi/action.rb', line 39

def self.action_suspend
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ReadState
    b.use Suspend
  end
end

.action_upObject



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/vagrant-vmware-esxi/action.rb', line 161

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use SetESXiPassword
    b.use ConfigValidate
    b.use HandleBox
    b.use ReadState
    b.use CreateVM
    b.use ReadState
    b.use Boot
    b.use Call, WaitForState, :running, 240 do |env1, b1|
      if env1[:result] == 'True'
        b1.use SetNetworkIP
        b1.use action_provision
      end
    end
  end
end