vagrant-subutai 7.0.4 → 7.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/CHANGELOG.md +71 -61
- data/lib/vagrant-subutai/blueprint/environment_controller.rb +76 -64
- data/lib/vagrant-subutai/blueprint/variables_controller.rb +29 -29
- data/lib/vagrant-subutai/packer/subutai_config.rb +22 -37
- data/lib/vagrant-subutai/packer/subutai_validation.rb +1 -0
- data/lib/vagrant-subutai/put.rb +4 -0
- data/lib/vagrant-subutai/registration.rb +18 -1
- data/lib/vagrant-subutai/rest/bazaar.rb +1 -1
- data/lib/vagrant-subutai/version.rb +1 -1
- data/test/subutai_disk_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6eb73b6420f3706a1cb5a525a7bbc9c7c8d2172
|
4
|
+
data.tar.gz: e8d087dbc65c5268fc8d796f18bf685d9f527adc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1188edc48a875437c0c0f82b92ece3f66e6cd55f8401d76f9c4228f8041a507e42f17f9ffb7db68e6816abc36e76af13e725a2ea6597595eb5efb5fa19ddf152
|
7
|
+
data.tar.gz: 95fbb84d529ae8b01b6ede8c7ddee1f99e72859cd0a43e1723c1a678d768f893ba39cbf0f9b542fc922ceffe48ab4fce341a820f7011e6fe92544b4899ad0994
|
data/CHANGELOG.md
CHANGED
@@ -1,93 +1,103 @@
|
|
1
|
-
##
|
2
|
-
|
3
|
-
FEATURES:
|
4
|
-
|
5
|
-
- Blueprint provisioning in two modes bazaar and peer
|
6
|
-
- Open command PeerOS in browser
|
7
|
-
|
8
|
-
## 1.1.1 (March 15, 2018)
|
1
|
+
## 7.0.6 (October 17, 2018)
|
9
2
|
|
10
3
|
BUG FIXES:
|
4
|
+
- Blueprint provisioning via bazaar mode fixed
|
5
|
+
- Fixed .vagrant folder is being generated in several places. (edited)
|
11
6
|
|
12
|
-
|
7
|
+
FEATURES:
|
8
|
+
- [configuration] Added `shared` as a value in addition to `private` and `public` in the *SUBUTAI_SCOPE* configuration parameter
|
9
|
+
- [configuration] Implemented SUBUTAI_DESKTOP configuration parameter
|
10
|
+
- [Hyper-V] Write peer ip address to generated file
|
13
11
|
|
14
|
-
##
|
12
|
+
## 7.0.4 (June 26, 2018)
|
15
13
|
|
16
14
|
BUG FIXES:
|
15
|
+
- Blueprint provisioning template not found fixed
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
FEATURES:
|
18
|
+
- Added new bridge configuration property by specific hypervisor
|
19
|
+
- User configuration added new keys:
|
20
|
+
- SUBUTAI_DISK
|
21
|
+
- BRIDGE_VIRTUALBOX
|
22
|
+
- BRIDGE_PARALLELS
|
23
|
+
- BRIDGE_VMWARE
|
24
|
+
- BRIDGE_KVM
|
25
|
+
- BRIDGE_HYPERV
|
21
26
|
|
27
|
+
## 7.0.3 (May 30, 2018)
|
28
|
+
|
22
29
|
BUG FIXES:
|
30
|
+
- [hyperv, vmware_desktop] fixed delete virtual disk file after destroy VM
|
31
|
+
- user configuration validation
|
23
32
|
|
24
|
-
|
25
|
-
- Long running ansible playbook error fixed
|
33
|
+
## 7.0.2 (May 22, 2018)
|
26
34
|
|
27
|
-
|
35
|
+
BUG FIXES:
|
36
|
+
- Fixed validation url
|
28
37
|
|
29
|
-
|
38
|
+
## 7.0.1 (May 21, 2018)
|
30
39
|
|
31
|
-
|
40
|
+
FEATURES:
|
41
|
+
- Support HyperV hypervisor
|
42
|
+
- Improved validation (user configuration)
|
32
43
|
|
33
|
-
|
34
|
-
- Libvirt disk size function added
|
35
|
-
- Cdn verfify certificate removed
|
36
|
-
|
37
|
-
## 1.1.5 (March 31, 2018)
|
44
|
+
## 7.0.0 (May 9, 2018)
|
38
45
|
|
39
46
|
FEATURES:
|
40
|
-
-
|
41
|
-
|
42
|
-
|
47
|
+
- Support Vmware desktop and Parallels hypervisor
|
48
|
+
- Auto registration PeerOs to Bazaar
|
49
|
+
- User configuration new keys added (BAZAAR_NO_AUTO)
|
43
50
|
|
44
|
-
BUG FIXES:
|
45
|
-
- User configuration values case sensitive fixed
|
46
|
-
|
47
51
|
## 1.1.7 (April 7, 2018)
|
48
52
|
|
49
53
|
BUG FIXES:
|
50
54
|
- null port forward value fixed
|
51
55
|
|
52
56
|
FEATURES:
|
53
|
-
- User configuration new keys added (LIBVIRT_USER, LIBVIRT_HOST, LIBVIRT_PORT, LIBVIRT_MACVTAP, LIBVIRT_NO_BRIDGE)
|
54
|
-
|
55
|
-
## 7.0.0 (May 9, 2018)
|
57
|
+
- User configuration new keys added (LIBVIRT_USER, LIBVIRT_HOST, LIBVIRT_PORT, LIBVIRT_MACVTAP, LIBVIRT_NO_BRIDGE)
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
- User configuration
|
61
|
-
|
62
|
-
##
|
59
|
+
## 1.1.6 (April 2, 2018)
|
60
|
+
|
61
|
+
BUG FIXES:
|
62
|
+
- User configuration values case sensitive fixed
|
63
|
+
|
64
|
+
## 1.1.5 (March 31, 2018)
|
63
65
|
|
64
66
|
FEATURES:
|
65
|
-
-
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
- [Command] `deregister` command added (For unregistering the PeerOS from Bazaar)
|
68
|
+
|
69
|
+
## 1.1.4 (March 30, 2018)
|
70
|
+
|
71
|
+
FEATURES:
|
72
|
+
- Libvirt disk size function added
|
73
|
+
- Cdn verfify certificate removed
|
74
|
+
|
75
|
+
## 1.1.3 (March 23, 2018)
|
69
76
|
|
70
77
|
BUG FIXES:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
78
|
+
|
79
|
+
- [Linux] arp command replaces with ip
|
80
|
+
- Long running ansible playbook error fixed
|
81
|
+
|
82
|
+
FEATURES:
|
83
|
+
|
84
|
+
- VM Disk Path variable added to conf file (SUBUTAI_DISK_PATH)
|
85
|
+
|
86
|
+
## 1.1.2 (March 15, 2018)
|
87
|
+
|
75
88
|
BUG FIXES:
|
76
|
-
|
77
|
-
-
|
78
|
-
|
79
|
-
##
|
89
|
+
|
90
|
+
- [Windows] Blueprint provisioning run first vagrant up
|
91
|
+
|
92
|
+
## 1.1.1 (March 15, 2018)
|
80
93
|
|
81
94
|
BUG FIXES:
|
82
|
-
- Blueprint provisioning template not found fixed
|
83
95
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
- BRIDGE_KVM
|
93
|
-
- BRIDGE_HYPERV
|
96
|
+
- Blueprint provisioning check for ready PeerOS
|
97
|
+
|
98
|
+
## 1.1.0 (March 13, 2018)
|
99
|
+
|
100
|
+
FEATURES:
|
101
|
+
|
102
|
+
- Blueprint provisioning in two modes bazaar and peer
|
103
|
+
- Open command PeerOS in browser
|
@@ -21,6 +21,7 @@ module VagrantSubutai
|
|
21
21
|
variable.check_required_quota
|
22
22
|
|
23
23
|
if mode == Configs::Blueprint::MODE::PEER
|
24
|
+
|
24
25
|
variable.user_variables
|
25
26
|
|
26
27
|
if variable.has_ansible?
|
@@ -136,8 +137,10 @@ module VagrantSubutai
|
|
136
137
|
response = VagrantSubutai::Rest::Bazaar.variables(variable.json, peer_id, token)
|
137
138
|
|
138
139
|
case response
|
139
|
-
|
140
|
+
when Net::HTTPOK
|
140
141
|
variables = JSON.parse(response.body)
|
142
|
+
Put.debug("Bazaar variables rest response: #{variables}")
|
143
|
+
|
141
144
|
conf_user_variables = SubutaiConfig.get(:USER_VARIABLES)
|
142
145
|
|
143
146
|
if conf_user_variables.nil?
|
@@ -154,8 +157,10 @@ module VagrantSubutai
|
|
154
157
|
end
|
155
158
|
|
156
159
|
params = []
|
160
|
+
Put.debug "JSON parsed variables response: #{variables}"
|
157
161
|
|
158
162
|
variables.each do |var|
|
163
|
+
Put.debug("For each in variables: #{var}")
|
159
164
|
temp = var
|
160
165
|
if conf_user_variables[var['name']].nil?
|
161
166
|
temp['value'] = variable.get_input_bazaar(var)
|
@@ -165,93 +170,100 @@ module VagrantSubutai
|
|
165
170
|
params << temp
|
166
171
|
end
|
167
172
|
|
173
|
+
Put.debug("Bazaar blueprint rest endpoint params: ")
|
174
|
+
Put.debug("Variable: #{variable.json}")
|
175
|
+
Put.debug("params: #{params.to_json}")
|
176
|
+
Put.debug("peer_id: #{peer_id}")
|
168
177
|
response = Rest::Bazaar.blueprint(variable.json, params, peer_id, token)
|
169
178
|
|
170
179
|
case response
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
+
when Net::HTTPAccepted
|
181
|
+
json = JSON.parse(response.body)
|
182
|
+
Put.debug("Bazaar blueprint rest endpoint response accepted: #{json}")
|
183
|
+
hub_id = json['id'] # Hub id
|
184
|
+
subutai_id = json['subutai_id'] # Subutai id
|
185
|
+
@id = subutai_id
|
186
|
+
|
187
|
+
Put.warn "\nStarted environment building ...... \n"
|
188
|
+
|
189
|
+
# Track environment create state logs
|
190
|
+
@log = Rest::Bazaar.log(token, subutai_id)
|
191
|
+
@log = JSON.parse(@log.body)
|
192
|
+
timer = Time.now + (60 * 60 * 17) # 17 hours
|
193
|
+
@last_peer_state = nil
|
194
|
+
|
195
|
+
until (@log['environment_status'] == Configs::EnvironmentState::HEALTHY || @log['environment_status'] == Configs::EnvironmentState::UNHEALTHY) && Time.now <= timer
|
180
196
|
@log = Rest::Bazaar.log(token, subutai_id)
|
181
|
-
@log = JSON.parse(@log.body)
|
182
|
-
timer = Time.now + (60 * 60 * 17) # 17 hours
|
183
|
-
@last_peer_state = nil
|
184
|
-
|
185
|
-
until (@log['environment_status'] == Configs::EnvironmentState::HEALTHY || @log['environment_status'] == Configs::EnvironmentState::UNHEALTHY) && Time.now <= timer
|
186
|
-
@log = Rest::Bazaar.log(token, subutai_id)
|
187
197
|
|
188
|
-
|
189
|
-
|
190
|
-
|
198
|
+
begin
|
199
|
+
@log = JSON.parse(@log.body)
|
200
|
+
environment_peers = @log['environment_peers']
|
191
201
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
end
|
197
|
-
@last_peer_state = v['peer_state']
|
202
|
+
environment_peers.each_with_index do |v, i|
|
203
|
+
if (@last_peer_state != v['peer_state'])
|
204
|
+
Put.info v['peer_state']
|
205
|
+
Put.info v['peer_message']
|
198
206
|
end
|
199
|
-
|
200
|
-
rescue JSON::ParserError => e
|
201
|
-
Put.error e
|
207
|
+
@last_peer_state = v['peer_state']
|
202
208
|
end
|
203
209
|
|
204
|
-
|
210
|
+
rescue JSON::ParserError => e
|
211
|
+
Put.error e
|
205
212
|
end
|
206
213
|
|
207
|
-
|
208
|
-
|
209
|
-
# Track ansible logs
|
214
|
+
sleep 5 # sleep 5 seconds
|
215
|
+
end
|
210
216
|
|
211
|
-
|
212
|
-
|
217
|
+
if @log['environment_status'] == Configs::EnvironmentState::HEALTHY
|
218
|
+
Put.success "\nEnvironment State: #{@log['environment_status']}"
|
219
|
+
# Track ansible logs
|
213
220
|
|
214
|
-
|
215
|
-
|
221
|
+
unless @log['environment_applications'].empty?
|
222
|
+
arr = @log['environment_applications']
|
216
223
|
|
217
|
-
|
218
|
-
|
224
|
+
arr.each_with_index do |environment_application, i|
|
225
|
+
@tmp = nil
|
219
226
|
|
220
|
-
|
221
|
-
|
227
|
+
until (@log['environment_applications'][i])['application_state'] == Configs::ApplicationState::INSTALLED
|
228
|
+
@log = Rest::Bazaar.log(token, subutai_id)
|
222
229
|
|
223
|
-
|
224
|
-
|
225
|
-
else
|
226
|
-
msg = (@log['environment_applications'][i])['application_log']
|
227
|
-
if @tmp.length < msg.length
|
228
|
-
msg = msg[(@tmp.length)..(msg.length-1)]
|
229
|
-
Put.info msg
|
230
|
-
end
|
231
|
-
end
|
232
|
-
@tmp = (@log['environment_applications'][i])['application_log']
|
230
|
+
begin
|
231
|
+
@log = JSON.parse(@log.body)
|
233
232
|
|
234
|
-
|
235
|
-
Put.
|
233
|
+
if @tmp.nil?
|
234
|
+
Put.info (@log['environment_applications'][i])['application_log']
|
235
|
+
else
|
236
|
+
msg = (@log['environment_applications'][i])['application_log']
|
237
|
+
if @tmp.length < msg.length
|
238
|
+
msg = msg[(@tmp.length)..(msg.length-1)]
|
239
|
+
Put.info msg
|
240
|
+
end
|
236
241
|
end
|
242
|
+
@tmp = (@log['environment_applications'][i])['application_log']
|
237
243
|
|
238
|
-
|
244
|
+
rescue JSON::ParserError => e
|
245
|
+
Put.error e
|
239
246
|
end
|
247
|
+
|
248
|
+
sleep 5 # sleep 5 seconds
|
240
249
|
end
|
241
250
|
end
|
242
|
-
elsif @log['environment_status'] == Configs::EnvironmentState::UNHEALTHY
|
243
|
-
Put.error "\nEnvironment State: #{@log['environment_status']}"
|
244
|
-
elsif timer < Time.now
|
245
|
-
Put.error "\nEnvironment State: Timeout environment creating"
|
246
|
-
else
|
247
|
-
Put.error "\nEnvironment State: #{@log['environment_status']}"
|
248
251
|
end
|
252
|
+
elsif @log['environment_status'] == Configs::EnvironmentState::UNHEALTHY
|
253
|
+
Put.error "\nEnvironment State: #{@log['environment_status']}"
|
254
|
+
elsif timer < Time.now
|
255
|
+
Put.error "\nEnvironment State: Timeout environment creating"
|
249
256
|
else
|
250
|
-
Put.error
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
257
|
+
Put.error "\nEnvironment State: #{@log['environment_status']}"
|
258
|
+
end
|
259
|
+
else
|
260
|
+
Put.debug("Bazaar blueprint rest endpoint error: ")
|
261
|
+
Put.error response.body
|
262
|
+
end
|
263
|
+
else
|
264
|
+
Put.debug "Failed bazaar variable rest endpoint"
|
265
|
+
Put.error response.body
|
266
|
+
Put.error response.message
|
255
267
|
end
|
256
268
|
end
|
257
269
|
end
|
@@ -391,40 +391,40 @@ module VagrantSubutai
|
|
391
391
|
|
392
392
|
def get_input_bazaar(variable)
|
393
393
|
Put.info "\n#{variable['label']}"
|
394
|
-
if variable.key?('acceptableValues')
|
395
|
-
if variable['type'] == 'enum'
|
396
|
-
arr = variable['acceptableValues'].split(',')
|
397
|
-
temp = nil
|
398
394
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
Put.info "\nChoose your container size between ( 0 to #{temp}): "
|
405
|
-
input = STDIN.gets.strip.to_i
|
406
|
-
arr[input]
|
407
|
-
elsif variable['type'] == 'domain'
|
408
|
-
arr = variable['acceptableValues'].split(',')
|
409
|
-
temp = nil
|
395
|
+
if variable['type'] == 'enum'
|
396
|
+
arr = []
|
397
|
+
arr = variable['acceptableValues'] if variable.key?('acceptableValues')
|
398
|
+
temp = -1
|
410
399
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
Put.info " #{temp+1}. Create a new domain: (Ex: YOUR_DOMAIN_NAME.envs.subutai.cloud)"
|
400
|
+
arr.each_with_index do |val, index|
|
401
|
+
Put.info " #{index}. #{val}"
|
402
|
+
temp = index
|
403
|
+
end
|
416
404
|
|
417
|
-
|
418
|
-
|
405
|
+
Put.info "\nChoose your container size between ( 0 to #{temp}): "
|
406
|
+
input = STDIN.gets.strip.to_i
|
407
|
+
arr[input]
|
408
|
+
elsif variable['type'] == 'domain'
|
409
|
+
arr = []
|
410
|
+
arr = variable['acceptableValues'] if variable.key?('acceptableValues')
|
411
|
+
temp = -1
|
412
|
+
|
413
|
+
arr.each_with_index do |val, index|
|
414
|
+
Put.info " #{index}. #{val}"
|
415
|
+
temp = index
|
416
|
+
end
|
417
|
+
Put.info " #{temp+1}. Create a new domain: (Ex: YOUR_DOMAIN_NAME.envs.subutai.cloud)"
|
419
418
|
|
420
|
-
|
421
|
-
|
422
|
-
reserve
|
423
|
-
else
|
424
|
-
Put.success "\n Chosen a domain: #{arr[input]}"
|
425
|
-
arr[input]
|
426
|
-
end
|
419
|
+
Put.info "\nChoose options: ( 0 to #{temp+1}) "
|
420
|
+
input = STDIN.gets.strip.to_i
|
427
421
|
|
422
|
+
if temp+1 == input
|
423
|
+
Put.success "\nCreate a new domain: (Ex: YOUR_DOMAIN_NAME.envs.subutai.cloud)"
|
424
|
+
reserve
|
425
|
+
else
|
426
|
+
Put.success "\n Chosen a domain: #{arr[input]}"
|
427
|
+
arr[input]
|
428
428
|
end
|
429
429
|
else
|
430
430
|
STDIN.gets.strip
|
@@ -18,7 +18,7 @@ module SubutaiConfig
|
|
18
18
|
CONF_FILE = File.expand_path('./vagrant-subutai.yml').freeze
|
19
19
|
USER_CONF_FILE = File.expand_path('~/.vagrant-subutai/vagrant-subutai.yml').freeze
|
20
20
|
SUBUTAI_ENVIRONMENTS = %i[prod master dev sysnet].freeze
|
21
|
-
SUBUTAI_SCOPES = %i[Public Private].freeze
|
21
|
+
SUBUTAI_SCOPES = %i[Public Private Shared].freeze
|
22
22
|
SUBUTAI_ENV_TYPES = %i[bazaar peer].freeze
|
23
23
|
|
24
24
|
# Without a variable key listed here it will not get pulled in from
|
@@ -53,6 +53,7 @@ module SubutaiConfig
|
|
53
53
|
LIBVIRT_PORT
|
54
54
|
LIBVIRT_MACVTAP
|
55
55
|
LIBVIRT_NO_BRIDGE
|
56
|
+
LIBVIRT_POOL
|
56
57
|
BAZAAR_NO_AUTO
|
57
58
|
SUBUTAI_DISK
|
58
59
|
BRIDGE_VIRTUALBOX
|
@@ -74,6 +75,7 @@ module SubutaiConfig
|
|
74
75
|
_DISK_SIZE
|
75
76
|
_DISK_PORT
|
76
77
|
_DISK_PATHES
|
78
|
+
_IP_HYPERV
|
77
79
|
].freeze
|
78
80
|
|
79
81
|
# Used for testing
|
@@ -105,11 +107,19 @@ module SubutaiConfig
|
|
105
107
|
LIBVIRT_MACVTAP: false, # Libvirt macvtap interface
|
106
108
|
BAZAAR_NO_AUTO: false, # PeerOs automatic registration to Bazaar (turn on(false), turn off(true))
|
107
109
|
PROVISION: true, # to provision or not to
|
110
|
+
LIBVIRT_POOL: 'default', # Libvirt pool name
|
108
111
|
|
109
112
|
# Configuration parameters below have not been implemented
|
110
113
|
SUBUTAI_DESKTOP: false, # install desktop with tray and p2p client
|
111
114
|
SUBUTAI_MAN_TMPL: nil, # provision alternative management template
|
112
|
-
APT_PROXY_URL: nil # configure apt proxy URL
|
115
|
+
APT_PROXY_URL: nil, # configure apt proxy URL
|
116
|
+
|
117
|
+
# provider with value
|
118
|
+
hyper_v: 'hyperv',
|
119
|
+
parallels: 'parallels',
|
120
|
+
virtualbox: 'virtualbox',
|
121
|
+
libvirt: 'libvirt',
|
122
|
+
vmware: 'vmware_desktop'
|
113
123
|
}
|
114
124
|
|
115
125
|
# User provided configuration settings
|
@@ -301,7 +311,7 @@ module SubutaiConfig
|
|
301
311
|
end
|
302
312
|
|
303
313
|
def self.set_scope(key, value)
|
304
|
-
raise "Invalid #{key} value of #{value}: use public or
|
314
|
+
raise "Invalid #{key} value of #{value}: use public, private or shared" \
|
305
315
|
unless SUBUTAI_SCOPES.include?(value.capitalize)
|
306
316
|
@config.store(key, value.capitalize)
|
307
317
|
end
|
@@ -333,7 +343,7 @@ module SubutaiConfig
|
|
333
343
|
# NOTE: SSH port only needed in bridged mode
|
334
344
|
def self.do_network(provider)
|
335
345
|
# set the next available console port if provisioning a peer in nat mode
|
336
|
-
put(:_CONSOLE_PORT, find_port(get(:DESIRED_CONSOLE_PORT)),
|
346
|
+
put(:_CONSOLE_PORT, find_port(get(:DESIRED_CONSOLE_PORT)), write?) \
|
337
347
|
if boolean?(:SUBUTAI_PEER) && get(:_CONSOLE_PORT).nil? && (write? || delete? || read?)
|
338
348
|
|
339
349
|
# set the SSH port if we are using bridged mode
|
@@ -374,6 +384,13 @@ module SubutaiConfig
|
|
374
384
|
load_config_file(conf_file) if File.exist?(conf_file)
|
375
385
|
load_generated
|
376
386
|
|
387
|
+
# Write empty file with name provider
|
388
|
+
# ControlCenter uses for checking provider of peer
|
389
|
+
unless File.exist?(File.join(PARENT_DIR, @defaults[@provider]))
|
390
|
+
file = File.new(File.join(PARENT_DIR, @defaults[@provider]), 'w')
|
391
|
+
file.close
|
392
|
+
end
|
393
|
+
|
377
394
|
# Load overrides from the environment, and generated configurations
|
378
395
|
ENV.each do |key, value|
|
379
396
|
put(key.to_sym, value, false) if USER_PARAMETERS.include? key.to_sym
|
@@ -443,39 +460,7 @@ module SubutaiConfig
|
|
443
460
|
end
|
444
461
|
|
445
462
|
def self.get_latest_id_artifact(owner, artifact_name)
|
446
|
-
|
447
|
-
begin
|
448
|
-
url = url_of_cdn + '/raw/info?owner=' + owner + '&name=' + artifact_name
|
449
|
-
uri = URI.parse(url)
|
450
|
-
https = Net::HTTP.new(uri.host, uri.port)
|
451
|
-
https.use_ssl = true
|
452
|
-
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
453
|
-
https.read_timeout = 3600 # an hour
|
454
|
-
|
455
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
456
|
-
response = https.request(request)
|
457
|
-
|
458
|
-
case response
|
459
|
-
when Net::HTTPOK
|
460
|
-
response = JSON.parse(response.body)
|
461
|
-
response[0]['id']
|
462
|
-
when Net::HTTPNotFound
|
463
|
-
Put.error "#{response.body} template name #{name}, owner #{owner}"
|
464
|
-
"" # send empty id. DON'T REMOVE
|
465
|
-
end
|
466
|
-
rescue Errno::ECONNREFUSED
|
467
|
-
Put.error "cdn.subutai.io:8338 connection refused"
|
468
|
-
"" # send empty id. DON'T REMOVE
|
469
|
-
rescue Errno::EHOSTUNREACH
|
470
|
-
Put.error "cdn.subutai.io:8338 unreachable"
|
471
|
-
"" # send empty id. DON'T REMOVE
|
472
|
-
rescue => e
|
473
|
-
Put.error e
|
474
|
-
"" # send empty id. DON'T REMOVE
|
475
|
-
end
|
476
|
-
else
|
477
|
-
"" # send empty id. DON'T REMOVE
|
478
|
-
end
|
463
|
+
"" # send empty id.
|
479
464
|
end
|
480
465
|
end
|
481
466
|
|
data/lib/vagrant-subutai/put.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require_relative '../vagrant-subutai'
|
2
|
-
|
2
|
+
require 'ipaddr'
|
3
3
|
|
4
4
|
module VagrantSubutai
|
5
5
|
class Registration < Vagrant.plugin(2, :provisioner)
|
@@ -59,6 +59,19 @@ module VagrantSubutai
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
# Write peer ip address to genereted file if provider Hyper-V
|
64
|
+
if SubutaiConfig.boolean?(:SUBUTAI_PEER) && SubutaiConfig.provider == :hyper_v
|
65
|
+
subutai_cli = Commands.new(ARGV, @machine.env)
|
66
|
+
ip = subutai_cli.info(Configs::VagrantCommand::ARG_IP_ADDR)
|
67
|
+
|
68
|
+
if ip.nil?
|
69
|
+
STDOUT.puts 'We can\'t detect your PeerOS ip address!'
|
70
|
+
exit
|
71
|
+
end
|
72
|
+
|
73
|
+
SubutaiConfig.put(:_IP_HYPERV, ip, true) if is_ip?(ip)
|
74
|
+
end
|
62
75
|
end
|
63
76
|
|
64
77
|
# This is the method called when destroying a machine that allows
|
@@ -66,5 +79,9 @@ module VagrantSubutai
|
|
66
79
|
# to be cleaned up.
|
67
80
|
def cleanup
|
68
81
|
end
|
82
|
+
|
83
|
+
def is_ip?(ip)
|
84
|
+
!!IPAddr.new(ip) rescue false
|
85
|
+
end
|
69
86
|
end
|
70
87
|
end
|
@@ -14,7 +14,7 @@ module VagrantSubutai
|
|
14
14
|
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
15
15
|
https.read_timeout = 3600 # an hour
|
16
16
|
|
17
|
-
request = Net::HTTP::
|
17
|
+
request = Net::HTTP::Post.new(uri.request_uri, {'Cookie' => cookies, 'Content-Type' => 'application/x-www-form-urlencoded'})
|
18
18
|
request.set_form_data({'blueprint' => subutai_json.to_json, 'peers' => [peers_id]})
|
19
19
|
|
20
20
|
https.request(request)
|
data/test/subutai_disk_test.rb
CHANGED
@@ -168,7 +168,7 @@ class SubutaiDiskTest < Test::Unit::TestCase
|
|
168
168
|
SubutaiConfig.override_conf_file('./test/disk_create.yml')
|
169
169
|
SubutaiConfig.load_config('up', :virtualbox)
|
170
170
|
|
171
|
-
assert_equal("==> default: Disk size configured to 101GB, increasing
|
171
|
+
assert_equal("==> default: Disk size configured to 101GB, increasing 100GB default by 1GB.",
|
172
172
|
SubutaiDisk.message(SubutaiConfig.get_grow_by))
|
173
173
|
end
|
174
174
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-subutai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subutai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|