vagrant-proxmox 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/required_parameters.rb +9 -0
- data/lib/sanity_checks.rb +6 -2
- data/lib/vagrant-proxmox/proxmox/connection.rb +10 -7
- data/lib/vagrant-proxmox/version.rb +1 -1
- metadata +60 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d86a90fe57dfe5b5e6e301b57308feb678e868
|
4
|
+
data.tar.gz: 3372e88c27a4fd155bccc466d851109eecf6ef92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 911850cd404dffe56562c95c6e1fc293ba7771cb618339f9be5d8bda7ba3e30c956e3d180156e0d9b0dda7751737439fd4e0b782c871936fe32dfc3e02efe161
|
7
|
+
data.tar.gz: 8ddd8000896e351c5b1da84fa7b218a54ce71bb1405657437db61991097d97a5fb3c0cad5eaa01a0288163f781fac14b3205663557162e94fbec0a2a9b84ab72
|
data/lib/sanity_checks.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
begin
|
2
2
|
require 'vagrant'
|
3
3
|
rescue LoadError
|
4
|
-
|
4
|
+
fail 'The Vagrant Proxmox plugin must be run within Vagrant.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# This is a sanity check to make sure no one is attempting to install
|
8
8
|
# this into an early Vagrant version.
|
9
9
|
if Vagrant::VERSION < '1.4.0'
|
10
|
-
|
10
|
+
fail 'The Vagrant Proxmox plugin is only compatible with Vagrant 1.2+'
|
11
11
|
end
|
12
|
+
|
13
|
+
if RUBY_VERSION.to_i < 2
|
14
|
+
fail 'The Vagrant Proxmox plugin is ony compatible with Ruby 2.0+'
|
15
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'vagrant-proxmox/proxmox/errors'
|
2
2
|
require 'rest-client'
|
3
3
|
require 'retryable'
|
4
|
+
require 'required_parameters'
|
4
5
|
|
5
6
|
# Fix wrong header unescaping in RestClient library.
|
6
7
|
module RestClient
|
@@ -20,6 +21,8 @@ module VagrantPlugins
|
|
20
21
|
module Proxmox
|
21
22
|
class Connection
|
22
23
|
|
24
|
+
include RequiredParameters
|
25
|
+
|
23
26
|
attr_reader :api_url
|
24
27
|
attr_reader :ticket
|
25
28
|
attr_reader :csrf_token
|
@@ -36,7 +39,7 @@ module VagrantPlugins
|
|
36
39
|
@imgcopy_timeout = opts[:imgcopy_timeout] || 120
|
37
40
|
end
|
38
41
|
|
39
|
-
def login(username
|
42
|
+
def login username: required('username'), password: required('password')
|
40
43
|
begin
|
41
44
|
response = post "/access/ticket", username: username, password: password
|
42
45
|
@ticket = response[:data][:ticket]
|
@@ -69,7 +72,7 @@ module VagrantPlugins
|
|
69
72
|
end
|
70
73
|
end
|
71
74
|
|
72
|
-
def wait_for_completion task_response: task_response, timeout_message: timeout_message
|
75
|
+
def wait_for_completion task_response: required('task_response'), timeout_message: required('timeout_message')
|
73
76
|
task_upid = task_response[:data]
|
74
77
|
timeout = task_timeout
|
75
78
|
task_type = /UPID:.*?:.*?:.*?:.*?:(.*)?:.*?:.*?:/.match(task_upid)[1]
|
@@ -92,7 +95,7 @@ module VagrantPlugins
|
|
92
95
|
wait_for_completion task_response: response, timeout_message: 'vagrant_proxmox.errors.destroy_vm_timeout'
|
93
96
|
end
|
94
97
|
|
95
|
-
def create_vm(node
|
98
|
+
def create_vm node: required('node'), vm_type: required('node'), params: required('params')
|
96
99
|
response = post "/nodes/#{node}/#{vm_type}", params
|
97
100
|
wait_for_completion task_response: response, timeout_message: 'vagrant_proxmox.errors.create_vm_timeout'
|
98
101
|
end
|
@@ -123,7 +126,7 @@ module VagrantPlugins
|
|
123
126
|
free_vm_ids.empty? ? raise(VagrantPlugins::Proxmox::Errors::NoVmIdAvailable) : free_vm_ids.first
|
124
127
|
end
|
125
128
|
|
126
|
-
def upload_file
|
129
|
+
def upload_file file, content_type: required('content_type'), node: required('node'), storage: required('storage')
|
127
130
|
unless is_file_in_storage? filename: file, node: node, storage: storage
|
128
131
|
res = post "/nodes/#{node}/storage/#{storage}/upload", content: content_type,
|
129
132
|
filename: File.new(file, 'rb'), node: node, storage: storage
|
@@ -131,7 +134,7 @@ module VagrantPlugins
|
|
131
134
|
end
|
132
135
|
end
|
133
136
|
|
134
|
-
def list_storage_files(node
|
137
|
+
def list_storage_files node: required('node'), storage: required('storage')
|
135
138
|
res = get "/nodes/#{node}/storage/#{storage}/content"
|
136
139
|
res[:data].map { |e| e[:volid] }
|
137
140
|
end
|
@@ -144,7 +147,7 @@ module VagrantPlugins
|
|
144
147
|
response = get '/cluster/resources?type=vm'
|
145
148
|
response[:data]
|
146
149
|
.select { |m| m[:id] =~ /^[a-z]*\/#{vm_id}$/ }
|
147
|
-
.map {|m|
|
150
|
+
.map { |m| {id: vm_id, type: /^(.*)\/(.*)$/.match(m[:id])[1], node: m[:node]} }
|
148
151
|
.first
|
149
152
|
end
|
150
153
|
|
@@ -209,7 +212,7 @@ module VagrantPlugins
|
|
209
212
|
end
|
210
213
|
|
211
214
|
private
|
212
|
-
def is_file_in_storage?(filename
|
215
|
+
def is_file_in_storage? filename: required('filename'), node: required('node'), storage: required('storage')
|
213
216
|
(list_storage_files node: node, storage: storage).find { |f| f =~ /#{File.basename filename}/ }
|
214
217
|
end
|
215
218
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-proxmox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dirk Grappendorf
|
@@ -10,118 +10,118 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 1.6.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 1.6.7
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: retryable
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 1.3.3
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.3.3
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: activesupport
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 4.0.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ~>
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 4.0.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rake
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: rspec
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 3.0.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ~>
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 3.0.0
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: simplecov
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ~>
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: 0.9.0
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ~>
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: 0.9.0
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: simplecov-rcov
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ~>
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: 0.2.3
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ~>
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 0.2.3
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: geminabox
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ~>
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: 0.11.1
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - ~>
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 0.11.1
|
127
127
|
- !ruby/object:Gem::Dependency
|
@@ -142,70 +142,70 @@ dependencies:
|
|
142
142
|
name: libnotify
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - ~>
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: 0.8.3
|
148
148
|
type: :development
|
149
149
|
prerelease: false
|
150
150
|
version_requirements: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- -
|
152
|
+
- - ~>
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: 0.8.3
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
156
|
name: timecop
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - ~>
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: 0.7.1
|
162
162
|
type: :development
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - ~>
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: 0.7.1
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: cucumber
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- -
|
173
|
+
- - ~>
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: 1.3.15
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
178
|
version_requirements: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
|
-
- -
|
180
|
+
- - ~>
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: 1.3.15
|
183
183
|
- !ruby/object:Gem::Dependency
|
184
184
|
name: webmock
|
185
185
|
requirement: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- -
|
187
|
+
- - ~>
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: 1.18.0
|
190
190
|
type: :development
|
191
191
|
prerelease: false
|
192
192
|
version_requirements: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
|
-
- -
|
194
|
+
- - ~>
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: 1.18.0
|
197
197
|
- !ruby/object:Gem::Dependency
|
198
198
|
name: awesome_print
|
199
199
|
requirement: !ruby/object:Gem::Requirement
|
200
200
|
requirements:
|
201
|
-
- -
|
201
|
+
- - ~>
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: 1.2.0
|
204
204
|
type: :development
|
205
205
|
prerelease: false
|
206
206
|
version_requirements: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
|
-
- -
|
208
|
+
- - ~>
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: 1.2.0
|
211
211
|
description: Enables Vagrant to manage virtual machines on a Proxmox server.
|
@@ -217,6 +217,7 @@ executables: []
|
|
217
217
|
extensions: []
|
218
218
|
extra_rdoc_files: []
|
219
219
|
files:
|
220
|
+
- lib/required_parameters.rb
|
220
221
|
- lib/sanity_checks.rb
|
221
222
|
- lib/vagrant-proxmox.rb
|
222
223
|
- lib/vagrant-proxmox/action.rb
|
@@ -301,12 +302,12 @@ require_paths:
|
|
301
302
|
- lib
|
302
303
|
required_ruby_version: !ruby/object:Gem::Requirement
|
303
304
|
requirements:
|
304
|
-
- -
|
305
|
+
- - '>='
|
305
306
|
- !ruby/object:Gem::Version
|
306
|
-
version: '
|
307
|
+
version: '2'
|
307
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
309
|
requirements:
|
309
|
-
- -
|
310
|
+
- - '>='
|
310
311
|
- !ruby/object:Gem::Version
|
311
312
|
version: '0'
|
312
313
|
requirements: []
|
@@ -316,43 +317,43 @@ signing_key:
|
|
316
317
|
specification_version: 4
|
317
318
|
summary: Enables Vagrant to manage virtual machines on a Proxmox server.
|
318
319
|
test_files:
|
319
|
-
- spec/config_spec.rb
|
320
|
-
- spec/commands/halt_command_spec.rb
|
321
|
-
- spec/commands/up_command_spec.rb
|
322
|
-
- spec/commands/destroy_command_spec.rb
|
323
|
-
- spec/commands/ssh_run_command_spec.rb
|
324
|
-
- spec/commands/provision_command_spec.rb
|
325
|
-
- spec/commands/status_command_spec.rb
|
326
|
-
- spec/commands/ssh_command_spec.rb
|
327
|
-
- spec/actions/create_vm_action_spec.rb
|
328
|
-
- spec/actions/get_node_list_action_spec.rb
|
329
|
-
- spec/actions/message_file_not_found_spec.rb
|
330
|
-
- spec/actions/read_ssh_info_action_spec.rb
|
331
|
-
- spec/actions/is_stopped_action_spec.rb
|
332
|
-
- spec/actions/is_created_action_spec.rb
|
333
|
-
- spec/actions/cleanup_after_destroy_action_spec.rb
|
334
|
-
- spec/actions/message_not_running_action_spec.rb
|
335
|
-
- spec/actions/start_vm_action_spec.rb
|
336
|
-
- spec/actions/shutdown_vm_action_spec.rb
|
337
|
-
- spec/actions/stop_vm_action_spec.rb
|
338
|
-
- spec/actions/message_already_stopped_action_spec.rb
|
339
|
-
- spec/actions/upload_iso_file_action_spec.rb
|
340
320
|
- spec/actions/message_already_running_action_spec.rb
|
341
|
-
- spec/actions/upload_template_file_action_spec.rb
|
342
|
-
- spec/actions/connect_proxmox_action_spec.rb
|
343
321
|
- spec/actions/destroy_vm_action_spec.rb
|
322
|
+
- spec/actions/start_vm_action_spec.rb
|
344
323
|
- spec/actions/proxmox_action_shared.rb
|
345
324
|
- spec/actions/sync_folders_action_spec.rb
|
346
|
-
- spec/actions/
|
347
|
-
- spec/actions/
|
325
|
+
- spec/actions/connect_proxmox_action_spec.rb
|
326
|
+
- spec/actions/cleanup_after_destroy_action_spec.rb
|
327
|
+
- spec/actions/is_stopped_action_spec.rb
|
328
|
+
- spec/actions/read_ssh_info_action_spec.rb
|
329
|
+
- spec/actions/create_vm_action_spec.rb
|
348
330
|
- spec/actions/proxmox_action_spec.rb
|
331
|
+
- spec/actions/shutdown_vm_action_spec.rb
|
349
332
|
- spec/actions/read_state_action_spec.rb
|
333
|
+
- spec/actions/message_already_stopped_action_spec.rb
|
334
|
+
- spec/actions/stop_vm_action_spec.rb
|
335
|
+
- spec/actions/upload_template_file_action_spec.rb
|
336
|
+
- spec/actions/select_node_spec.rb
|
337
|
+
- spec/actions/upload_iso_file_action_spec.rb
|
350
338
|
- spec/actions/message_not_created_action_spec.rb
|
351
|
-
- spec/
|
339
|
+
- spec/actions/message_upload_server_error_spec.rb
|
340
|
+
- spec/actions/message_not_running_action_spec.rb
|
341
|
+
- spec/actions/get_node_list_action_spec.rb
|
342
|
+
- spec/actions/message_file_not_found_spec.rb
|
343
|
+
- spec/actions/is_created_action_spec.rb
|
352
344
|
- spec/plugin_spec.rb
|
345
|
+
- spec/spec_helper.rb
|
353
346
|
- spec/sanity_checks_spec.rb
|
354
|
-
- spec/proxmox/rest_call_shared.rb
|
355
347
|
- spec/proxmox/connection_spec.rb
|
356
|
-
- spec/
|
348
|
+
- spec/proxmox/rest_call_shared.rb
|
349
|
+
- spec/commands/ssh_command_spec.rb
|
350
|
+
- spec/commands/provision_command_spec.rb
|
351
|
+
- spec/commands/up_command_spec.rb
|
352
|
+
- spec/commands/destroy_command_spec.rb
|
353
|
+
- spec/commands/ssh_run_command_spec.rb
|
354
|
+
- spec/commands/halt_command_spec.rb
|
355
|
+
- spec/commands/status_command_spec.rb
|
356
|
+
- spec/config_spec.rb
|
357
|
+
- spec/provider_spec.rb
|
357
358
|
- spec/spec_helpers/time_helpers.rb
|
358
359
|
- spec/spec_helpers/common_helpers.rb
|