Module: VagrantPlugins::Proxmox::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-proxmox/action.rb,
lib/vagrant-proxmox/action/stop_vm.rb,
lib/vagrant-proxmox/action/start_vm.rb,
lib/vagrant-proxmox/action/create_vm.rb,
lib/vagrant-proxmox/action/destroy_vm.rb,
lib/vagrant-proxmox/action/is_created.rb,
lib/vagrant-proxmox/action/is_stopped.rb,
lib/vagrant-proxmox/action/read_state.rb,
lib/vagrant-proxmox/action/shutdown_vm.rb,
lib/vagrant-proxmox/action/sync_folders.rb,
lib/vagrant-proxmox/action/get_node_list.rb,
lib/vagrant-proxmox/action/read_ssh_info.rb,
lib/vagrant-proxmox/action/proxmox_action.rb,
lib/vagrant-proxmox/action/connect_proxmox.rb,
lib/vagrant-proxmox/action/message_not_created.rb,
lib/vagrant-proxmox/action/cleanup_after_destroy.rb,
lib/vagrant-proxmox/action/message_already_running.rb,
lib/vagrant-proxmox/action/message_already_stopped.rb

Defined Under Namespace

Classes: CleanupAfterDestroy, ConnectProxmox, CreateVm, DestroyVm, GetNodeList, IsCreated, IsStopped, MessageAlreadyRunning, MessageAlreadyStopped, MessageNotCreated, ProxmoxAction, ReadSSHInfo, ReadState, ShutdownVm, StartVm, StopVm, SyncFolders

Class Method Summary collapse

Class Method Details

.action_destroyObject

This action is called to destroy the remote machine.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/vagrant-proxmox/action.rb', line 79

def self.action_destroy
	Vagrant::Action::Builder.new.tap do |b|
		b.use ConfigValidate
		b.use ConnectProxmox
		b.use Call, IsCreated do |env1, b1|
			if env1[:result]
				b1.use Call, ::Vagrant::Action::Builtin::DestroyConfirm do |env2, b2|
					if env2[:result]
						b2.use Call, IsStopped do |env3, b3|
							b3.use ShutdownVm unless env3[:result]
							b3.use DestroyVm
							b3.use ::Vagrant::Action::Builtin::ProvisionerCleanup
							b3.use CleanupAfterDestroy
						end
					else
						b2.use ::VagrantPlugins::ProviderVirtualBox::Action::MessageWillNotDestroy
					end
				end
			else
				b1.use MessageNotCreated
			end
		end
	end
end

.action_haltObject



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

def self.action_halt
	Vagrant::Action::Builder.new.tap do |b|
		b.use ConfigValidate
		b.use Call, IsCreated do |env1, b1|
			if env1[:result]
				b1.use Call, IsStopped do |env2, b2|
					if env2[:result]
						b2.use MessageAlreadyStopped
					else
						b2.use ConnectProxmox
						b2.use ShutdownVm
					end
				end
			else
				b1.use MessageNotCreated
			end
		end
	end
end

.action_provisionObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/vagrant-proxmox/action.rb', line 44

def self.action_provision
	Vagrant::Action::Builder.new.tap do |b|
		b.use ConfigValidate
		b.use Call, IsCreated do |env, b2|
			if env[:result]
				b2.use Provision
				b2.use SyncFolders
			else
				b2.use MessageNotCreated
			end
		end
	end
end

.action_read_ssh_infoObject



104
105
106
107
108
109
110
# File 'lib/vagrant-proxmox/action.rb', line 104

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

.action_read_stateObject



10
11
12
13
14
15
16
# File 'lib/vagrant-proxmox/action.rb', line 10

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

.action_sshObject



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/vagrant-proxmox/action.rb', line 112

def self.action_ssh
	Vagrant::Action::Builder.new.tap do |b|
		b.use ConfigValidate
		b.use Call, IsCreated do |env, b2|
			if env[:result]
				b2.use SSHExec
			else
				b2.use MessageNotCreated
			end
		end
	end
end

.action_ssh_runObject



125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/vagrant-proxmox/action.rb', line 125

def self.action_ssh_run
	Vagrant::Action::Builder.new.tap do |b|
		b.use ConfigValidate
		b.use Call, IsCreated do |env, b2|
			if env[:result]
				b2.use SSHRun
			else
				b2.use MessageNotCreated
			end
		end
	end
end

.action_upObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vagrant-proxmox/action.rb', line 18

def self.action_up
	Vagrant::Action::Builder.new.tap do |b|
		b.use ConfigValidate
		b.use ConnectProxmox
		b.use Call, IsCreated do |env1, b1|
			if env1[:result]
				b1.use Call, IsStopped do |env2, b2|
					if env2[:result]
						b2.use Provision
						b2.use StartVm
						b2.use SyncFolders
					else
						b2.use MessageAlreadyRunning
					end
				end
			else
				b1.use GetNodeList
				b1.use Provision
				b1.use CreateVm
				b1.use StartVm
				b1.use SyncFolders
			end
		end
	end
end