vagrant-subutai 1.0.3 → 1.1.0
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/.gitignore +2 -1
- data/CHANGELOG.md +7 -0
- data/README.md +3 -2
- data/lib/vagrant-subutai.rb +33 -7
- data/lib/vagrant-subutai/blueprint/ansible_controller.rb +93 -0
- data/lib/vagrant-subutai/blueprint/environment_controller.rb +324 -0
- data/lib/vagrant-subutai/blueprint/variables_controller.rb +547 -0
- data/lib/vagrant-subutai/command.rb +84 -90
- data/lib/vagrant-subutai/config.rb +8 -43
- data/lib/vagrant-subutai/configs/configs.rb +179 -0
- data/lib/vagrant-subutai/models/ansible.rb +18 -0
- data/lib/vagrant-subutai/models/console/container.rb +27 -0
- data/lib/vagrant-subutai/models/console/environment.rb +16 -0
- data/lib/vagrant-subutai/models/container.rb +34 -0
- data/lib/vagrant-subutai/models/domain.rb +11 -0
- data/lib/vagrant-subutai/models/environment.rb +13 -0
- data/lib/vagrant-subutai/packer/subutai_config.rb +17 -1
- data/lib/vagrant-subutai/plugin.rb +10 -3
- data/lib/vagrant-subutai/provisioner.rb +63 -0
- data/lib/vagrant-subutai/put.rb +21 -0
- data/lib/vagrant-subutai/rest/bazaar.rb +141 -0
- data/lib/vagrant-subutai/rest/gorjun.rb +40 -0
- data/lib/vagrant-subutai/rest/subutai_console.rb +189 -0
- data/lib/vagrant-subutai/subutai_commands.rb +250 -122
- data/lib/vagrant-subutai/version.rb +1 -1
- metadata +18 -6
- data/Vagrantfile +0 -7
- data/lib/vagrant-subutai/models/resource_host.rb +0 -7
- data/lib/vagrant-subutai/rest.rb +0 -77
- data/lib/vagrant-subutai/rh_controller.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4105a1ad3b5e5d3f61465aa910e4e876297e5309
|
4
|
+
data.tar.gz: 4261d2ba9fe00f7e61e5edb060ebd5c561d18b2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04eb8cb919fac5be3a5e6dee6a31570a95b583d992a263133d00c84f831fd1d11b215669b22fce837e97a14ea5c1cad37bca92aa8147c6a81983fa1524666e13
|
7
|
+
data.tar.gz: ecc183b0935f57facd0131b9ebcc7465e28e52ed6646a8aee38190362ff63a28d50cdee25ffdbe01a39431a6f8c7f70d6ee662a59694984c534afa94a3264b93
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -42,9 +42,10 @@ COMMANDS:
|
|
42
42
|
tunnel - SSH tunnel management
|
43
43
|
update - update Subutai management, container or Resource host
|
44
44
|
vxlan - VXLAN tunnels operation
|
45
|
-
register - register Subutai
|
45
|
+
register - register Subutai PeerOS to Bazaar
|
46
46
|
fingerprint - shows fingerprint Subutai Console
|
47
|
-
|
47
|
+
open - open the Subutai PeerOS in browser
|
48
|
+
blueprint - run blueprint provisioning
|
48
49
|
|
49
50
|
GLOBAL OPTIONS:
|
50
51
|
-h, --help - show help
|
data/lib/vagrant-subutai.rb
CHANGED
@@ -1,13 +1,39 @@
|
|
1
1
|
require 'vagrant'
|
2
|
+
|
3
|
+
require 'vagrant-subutai/blueprint/ansible_controller'
|
4
|
+
require 'vagrant-subutai/blueprint/variables_controller'
|
5
|
+
require 'vagrant-subutai/blueprint/environment_controller'
|
6
|
+
|
7
|
+
require 'vagrant-subutai/configs/configs'
|
8
|
+
|
9
|
+
require 'vagrant-subutai/models/console/container'
|
10
|
+
require 'vagrant-subutai/models/console/environment'
|
11
|
+
require 'vagrant-subutai/models/ansible'
|
12
|
+
require 'vagrant-subutai/models/container'
|
13
|
+
require 'vagrant-subutai/models/domain'
|
14
|
+
require 'vagrant-subutai/models/environment'
|
15
|
+
|
16
|
+
require 'vagrant-subutai/packer/subutai_config'
|
17
|
+
require 'vagrant-subutai/packer/subutai_hooks'
|
18
|
+
require 'vagrant-subutai/packer/subutai_net'
|
19
|
+
require 'vagrant-subutai/packer/subutai_disk'
|
20
|
+
|
21
|
+
require 'vagrant-subutai/rest/bazaar'
|
22
|
+
require 'vagrant-subutai/rest/gorjun'
|
23
|
+
require 'vagrant-subutai/rest/subutai_console'
|
24
|
+
|
2
25
|
require 'vagrant-subutai/command'
|
3
26
|
require 'vagrant-subutai/config'
|
4
27
|
require 'vagrant-subutai/plugin'
|
5
|
-
require 'vagrant-subutai/
|
28
|
+
require 'vagrant-subutai/provisioner'
|
29
|
+
require 'vagrant-subutai/put'
|
6
30
|
require 'vagrant-subutai/subutai_commands'
|
7
31
|
require 'vagrant-subutai/version'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require_relative '../../vagrant-subutai'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module VagrantSubutai
|
5
|
+
module Blueprint
|
6
|
+
class AnsibleController
|
7
|
+
attr_accessor :ansible, # ansible model
|
8
|
+
:environment, # environment model
|
9
|
+
:url, # Subutai Console url
|
10
|
+
:token # Subutai Console token
|
11
|
+
|
12
|
+
def initialize(ansible, environment, url, token)
|
13
|
+
@ansible = ansible
|
14
|
+
@environment = environment
|
15
|
+
@url = url
|
16
|
+
@token = token
|
17
|
+
end
|
18
|
+
|
19
|
+
# Adds template hosts to ansible configuration
|
20
|
+
# /etc/ansible/hosts
|
21
|
+
def hosts
|
22
|
+
Put.warn "\nStarted configuring ansible hosts.......\n"
|
23
|
+
@ansible.groups.each do |group|
|
24
|
+
Put.info "Adding group [#{group['name']}]"
|
25
|
+
|
26
|
+
response = Rest::SubutaiConsole.command("echo [#{group['name']}] >> /etc/ansible/hosts", @environment.ansible_host_id, "/root","1000", @url, @token)
|
27
|
+
status(response)
|
28
|
+
|
29
|
+
group['hostnames'].each do |hostname|
|
30
|
+
container = find(hostname)
|
31
|
+
Put.info "Adding hosts #{container.containerName} to group [#{group['name']}]"
|
32
|
+
|
33
|
+
if group.key?('python-interpreter')
|
34
|
+
response = Rest::SubutaiConsole.command("echo \"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip} ansible_python_interpreter=#{group['python-interpreter']}\" >> /etc/ansible/hosts", @environment.ansible_host_id, "/root","360000", @url, @token)
|
35
|
+
status(response)
|
36
|
+
else
|
37
|
+
response = Rest::SubutaiConsole.command("echo \"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip}\" >> /etc/ansible/hosts", @environment.ansible_host_id, "/root","360000", @url, @token)
|
38
|
+
status(response)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Downloads ansible source
|
45
|
+
def download
|
46
|
+
Put.info "\nStarted downloading ansible source...."
|
47
|
+
#response = Rest::SubutaiConsole.command("ansible-playbook download.json -e 'ansible_python_interpreter=/usr/bin/python3' --extra-vars '{ \"source_url\": \"#{@ansible.source_url}\"}'", @environment.ansible_host_id, "/root","360000", @url, @token)
|
48
|
+
response = Rest::SubutaiConsole.command("bash /root/get_unzip.sh #{@ansible.source_url}", @environment.ansible_host_id, "/root","360000", @url, @token)
|
49
|
+
|
50
|
+
status(response)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Runs ansible playbook
|
54
|
+
def run
|
55
|
+
Put.info "\nStarted running ansible playbook may be take too long time please wait......."
|
56
|
+
if @ansible.extra_vars.empty?
|
57
|
+
response = Rest::SubutaiConsole.command("cd /root/*master/;ansible-playbook #{@ansible.ansible_playbook}", @environment.ansible_host_id, "/root","360000", @url, @token)
|
58
|
+
status(response)
|
59
|
+
else
|
60
|
+
extra_vars = {}
|
61
|
+
@ansible.extra_vars.each do |extra_var|
|
62
|
+
extra_var.map {|k, v| extra_vars[k] = v }
|
63
|
+
end
|
64
|
+
response = Rest::SubutaiConsole.command("cd /root/*master;ansible-playbook #{@ansible.ansible_playbook} --extra-vars '#{extra_vars.to_json}'", @environment.ansible_host_id, "/root","360000", @url, @token)
|
65
|
+
status(response)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Finds Container model from array by hostname
|
70
|
+
def find(hostname)
|
71
|
+
@environment.containers.find {|cont| cont.hostname.include?(hostname)}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Check request response status
|
75
|
+
def status(response)
|
76
|
+
case response
|
77
|
+
when Net::HTTPOK
|
78
|
+
response = JSON.parse(response.body)
|
79
|
+
if response['status'] == Configs::EnvironmentState::SUCCEEDED
|
80
|
+
Put.success response['status']
|
81
|
+
Put.info response['stdOut']
|
82
|
+
elsif response['status'] == Configs::EnvironmentState::FAILED
|
83
|
+
Put.error response['status']
|
84
|
+
Put.info response['stdOut']
|
85
|
+
Put.error response['stdErr']
|
86
|
+
end
|
87
|
+
else
|
88
|
+
Put.error response.body
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,324 @@
|
|
1
|
+
require_relative '../../vagrant-subutai'
|
2
|
+
require 'base64'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
|
6
|
+
module VagrantSubutai
|
7
|
+
module Blueprint
|
8
|
+
class EnvironmentController
|
9
|
+
attr_accessor :name, # Environment name
|
10
|
+
:ansible, # Environment ansible configurations
|
11
|
+
:log, # Environment build logs
|
12
|
+
:id, # Environment build id
|
13
|
+
:tracker_id, # Environment logs tracker id
|
14
|
+
:container_ids, # Container Hash {'hostname' => id}
|
15
|
+
:peer_os_token # Peer Os token
|
16
|
+
|
17
|
+
def build(url, token, rh_id, peer_id, mode)
|
18
|
+
|
19
|
+
variable = VagrantSubutai::Blueprint::VariablesController.new(@free_ram, @free_disk, mode)
|
20
|
+
variable.cookies = token # needs cookies while reserving domain to Bazaar
|
21
|
+
variable.check_required_quota
|
22
|
+
|
23
|
+
if mode == Configs::Blueprint::MODE::PEER
|
24
|
+
variable.user_variables
|
25
|
+
|
26
|
+
if variable.has_ansible?
|
27
|
+
@ansible = variable.ansible
|
28
|
+
end
|
29
|
+
|
30
|
+
params = variable.params(rh_id, peer_id)
|
31
|
+
@name = params['name']
|
32
|
+
|
33
|
+
response = Rest::SubutaiConsole.environment(url, token, params.to_json)
|
34
|
+
|
35
|
+
case response
|
36
|
+
when Net::HTTPAccepted
|
37
|
+
json = JSON.parse(response.body)
|
38
|
+
|
39
|
+
Put.warn "\nStarted \"#{@name}\" environment building ...... \n"
|
40
|
+
|
41
|
+
@id = json['environmentId']
|
42
|
+
@tracker_id = json['trackerId']
|
43
|
+
|
44
|
+
@log = VagrantSubutai::Rest::SubutaiConsole.log(url, token, @tracker_id)
|
45
|
+
@log = JSON.parse(@log.body)
|
46
|
+
|
47
|
+
decoded_log = Base64.decode64(@log['log'])
|
48
|
+
logs = decoded_log.split(/\{(.*?)\}\,/)
|
49
|
+
|
50
|
+
@logs_last_index = nil # this saves last logs index (for not showing duplicated logs)
|
51
|
+
@temp_last_index = nil
|
52
|
+
|
53
|
+
logs.each_with_index do |v, i|
|
54
|
+
v = v.split(',')
|
55
|
+
v.shift
|
56
|
+
Put.info "#{v[1]} #{v[0]}" unless v.empty?
|
57
|
+
@temp_last_index = i
|
58
|
+
end
|
59
|
+
|
60
|
+
@logs_last_index = @temp_last_index
|
61
|
+
|
62
|
+
until @log['state'] == Configs::EnvironmentState::SUCCEEDED || @log['state'] == Configs::EnvironmentState::FAILED
|
63
|
+
@log = VagrantSubutai::Rest::SubutaiConsole.log(url, token, @tracker_id)
|
64
|
+
|
65
|
+
begin
|
66
|
+
@log = JSON.parse(@log.body)
|
67
|
+
decoded_log = Base64.decode64(@log['log'])
|
68
|
+
logs = decoded_log.split(/\{(.*?)\}\,/)
|
69
|
+
|
70
|
+
logs.each_with_index do |v, i|
|
71
|
+
if @logs_last_index < i
|
72
|
+
v = v.split(',')
|
73
|
+
v.shift
|
74
|
+
Put.info "#{v[1]} #{v[0]}" unless v.empty?
|
75
|
+
end
|
76
|
+
@temp_last_index = i
|
77
|
+
end
|
78
|
+
|
79
|
+
@logs_last_index = @temp_last_index
|
80
|
+
rescue JSON::ParserError => e
|
81
|
+
Put.error e
|
82
|
+
end
|
83
|
+
|
84
|
+
sleep 5 # sleep 5 seconds
|
85
|
+
end
|
86
|
+
|
87
|
+
if @log['state'] == Configs::EnvironmentState::SUCCEEDED
|
88
|
+
Put.success "\nEnvironment State: #{@log['state']}"
|
89
|
+
|
90
|
+
if variable.has_ansible?
|
91
|
+
env = list(url, token)
|
92
|
+
|
93
|
+
ansible = VagrantSubutai::Blueprint::AnsibleController.new(@ansible, env, url, token)
|
94
|
+
ansible.hosts
|
95
|
+
ansible.download
|
96
|
+
ansible.run
|
97
|
+
else
|
98
|
+
list(url, token)
|
99
|
+
end
|
100
|
+
|
101
|
+
domain = variable.domain
|
102
|
+
unless domain.nil?
|
103
|
+
response = VagrantSubutai::Rest::SubutaiConsole.domain(url, token, @id, domain.name)
|
104
|
+
|
105
|
+
case response
|
106
|
+
when Net::HTTPOK
|
107
|
+
|
108
|
+
response = VagrantSubutai::Rest::SubutaiConsole.port(url, token, @id, @container_ids[domain.container_hostname], domain.internal_port)
|
109
|
+
|
110
|
+
unless response.code == 200
|
111
|
+
Put.error response.message
|
112
|
+
Put.error response.body
|
113
|
+
end
|
114
|
+
ip = url.gsub("https://", "")
|
115
|
+
ip = ip.gsub(':8443', '')
|
116
|
+
|
117
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
118
|
+
Put.warn "MESSAGE You're environment has been setup for a *local* #{domain.name}. You can map this domain to the IP address #{ip} in your C:\\Windows\\System32\\drivers\\etc\\hosts file or to your local DNS."
|
119
|
+
else
|
120
|
+
Put.warn "MESSAGE You're environment has been setup for a *local* #{domain.name}. You can map this domain to the IP address #{ip} in your /etc/hosts file or to your local DNS."
|
121
|
+
end
|
122
|
+
else
|
123
|
+
Put.error response.body
|
124
|
+
Put.error response.code
|
125
|
+
Put.error response.message
|
126
|
+
end
|
127
|
+
end
|
128
|
+
else
|
129
|
+
Put.error "\nEnvironment State: #{@log['state']}"
|
130
|
+
end
|
131
|
+
else
|
132
|
+
Put.error "Error: #{response.body}"
|
133
|
+
end
|
134
|
+
elsif mode == Configs::Blueprint::MODE::BAZAAR
|
135
|
+
# Bazaar new REST API to build blueprint provisioning
|
136
|
+
response = VagrantSubutai::Rest::Bazaar.variables(variable.json, peer_id, token)
|
137
|
+
|
138
|
+
case response
|
139
|
+
when Net::HTTPOK
|
140
|
+
variables = JSON.parse(response.body)
|
141
|
+
conf_user_variables = SubutaiConfig.get(:USER_VARIABLES)
|
142
|
+
|
143
|
+
if conf_user_variables.nil?
|
144
|
+
conf_user_variables = {}
|
145
|
+
else
|
146
|
+
if conf_user_variables.kind_of?(String)
|
147
|
+
begin
|
148
|
+
conf_user_variables = JSON.parse(SubutaiConfig.get(:USER_VARIABLES))
|
149
|
+
rescue JSON::ParserError => e
|
150
|
+
Put.error e
|
151
|
+
return
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
params = []
|
157
|
+
|
158
|
+
variables.each do |var|
|
159
|
+
temp = var
|
160
|
+
if conf_user_variables[var['name']].nil?
|
161
|
+
temp['value'] = variable.get_input_bazaar(var)
|
162
|
+
else
|
163
|
+
temp['value'] = conf_user_variables[var['name']]
|
164
|
+
end
|
165
|
+
params << temp
|
166
|
+
end
|
167
|
+
|
168
|
+
response = Rest::Bazaar.blueprint(variable.json, params, peer_id, token)
|
169
|
+
|
170
|
+
case response
|
171
|
+
when Net::HTTPAccepted
|
172
|
+
json = JSON.parse(response.body)
|
173
|
+
hub_id = json['hubId']
|
174
|
+
subutai_id = json['subutaiId']
|
175
|
+
@id = subutai_id
|
176
|
+
|
177
|
+
Put.warn "\nStarted environment building ...... \n"
|
178
|
+
|
179
|
+
# Track environment create state logs
|
180
|
+
@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
|
+
|
188
|
+
begin
|
189
|
+
@log = JSON.parse(@log.body)
|
190
|
+
environment_peers = @log['environment_peers']
|
191
|
+
|
192
|
+
environment_peers.each_with_index do |v, i|
|
193
|
+
if (@last_peer_state != v['peer_state'])
|
194
|
+
Put.info v['peer_state']
|
195
|
+
Put.info v['peer_message']
|
196
|
+
end
|
197
|
+
@last_peer_state = v['peer_state']
|
198
|
+
end
|
199
|
+
|
200
|
+
rescue JSON::ParserError => e
|
201
|
+
Put.error e
|
202
|
+
end
|
203
|
+
|
204
|
+
sleep 5 # sleep 5 seconds
|
205
|
+
end
|
206
|
+
|
207
|
+
if @log['environment_status'] == Configs::EnvironmentState::HEALTHY
|
208
|
+
Put.success "\nEnvironment State: #{@log['environment_status']}"
|
209
|
+
# Track ansible logs
|
210
|
+
|
211
|
+
unless @log['environment_applications'].empty?
|
212
|
+
arr = @log['environment_applications']
|
213
|
+
|
214
|
+
arr.each_with_index do |environment_application, i|
|
215
|
+
@tmp = nil
|
216
|
+
|
217
|
+
until (@log['environment_applications'][i])['application_state'] == Configs::ApplicationState::INSTALLED
|
218
|
+
@log = Rest::Bazaar.log(token, subutai_id)
|
219
|
+
|
220
|
+
begin
|
221
|
+
@log = JSON.parse(@log.body)
|
222
|
+
|
223
|
+
if @tmp.nil?
|
224
|
+
Put.info (@log['environment_applications'][i])['application_log']
|
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']
|
233
|
+
|
234
|
+
rescue JSON::ParserError => e
|
235
|
+
Put.error e
|
236
|
+
end
|
237
|
+
|
238
|
+
sleep 5 # sleep 5 seconds
|
239
|
+
end
|
240
|
+
end
|
241
|
+
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
|
+
end
|
249
|
+
else
|
250
|
+
Put.error response.body
|
251
|
+
end
|
252
|
+
else
|
253
|
+
Put.error response.body
|
254
|
+
Put.error response.message
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Checks peer available resource ram, disk
|
260
|
+
def check_free_quota(resource)
|
261
|
+
resource = JSON.parse(resource)
|
262
|
+
|
263
|
+
@free_ram = resource['RAM']['free'].to_f / 1073741824 # convert bytes to gb
|
264
|
+
@free_disk = (resource['Disk']['total'].to_f - resource['Disk']['used'].to_f) / 1073741824 # convert bytes to gb
|
265
|
+
end
|
266
|
+
|
267
|
+
# Gets Environment from Subutai Console REST API
|
268
|
+
def list(url, token)
|
269
|
+
env = VagrantSubutai::Models::Console::Environment.new
|
270
|
+
response = VagrantSubutai::Rest::SubutaiConsole.environments(url, token)
|
271
|
+
|
272
|
+
@container_ids = {}
|
273
|
+
|
274
|
+
case response
|
275
|
+
when Net:: HTTPOK
|
276
|
+
environments = JSON.parse(response.body)
|
277
|
+
|
278
|
+
environments.each do |environment|
|
279
|
+
|
280
|
+
if environment['id'] == @id
|
281
|
+
env.id = @id
|
282
|
+
env.name = environment['name']
|
283
|
+
env.status = environment['status']
|
284
|
+
env.containers = []
|
285
|
+
|
286
|
+
environment['containers'].each do |container|
|
287
|
+
if container['templateName'] == VagrantSubutai::Configs::Ansible::TEMPLATE_NAME
|
288
|
+
env.ansible_host_id = container['id']
|
289
|
+
env.ansible_container_state = container['state']
|
290
|
+
else
|
291
|
+
cont = VagrantSubutai::Models::Console::Container.new
|
292
|
+
cont.id = container['id']
|
293
|
+
cont.environmentId = container['environmentId']
|
294
|
+
cont.hostname = container['hostname']
|
295
|
+
cont.ip = container['ip']
|
296
|
+
cont.templateName = container['templateName']
|
297
|
+
cont.templateId = container['templateId']
|
298
|
+
cont.type = container['type']
|
299
|
+
cont.arch = container['arch']
|
300
|
+
cont.peerId = container['peerId']
|
301
|
+
cont.hostId = container['hostId']
|
302
|
+
cont.local = container['local']
|
303
|
+
cont.state = container['state']
|
304
|
+
cont.rhId = container['rhId']
|
305
|
+
cont.quota = container['quota']
|
306
|
+
cont.dataSource = container['dataSource']
|
307
|
+
cont.containerName = container['containerName']
|
308
|
+
@container_ids[cont.hostname] = cont.id
|
309
|
+
|
310
|
+
env.containers << cont
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
else
|
316
|
+
Put.error response.body
|
317
|
+
raise 'Can\'t get Environment lists from Subutai Console'
|
318
|
+
end
|
319
|
+
|
320
|
+
env
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|