vagrant-mos 0.9.31 → 0.9.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant-mos/action/package_instance.rb +3 -39
- data/lib/vagrant-mos/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1807abec6cd8938e53bcf04896a0b8c1644cedd9
|
4
|
+
data.tar.gz: 12170589079888dc3eb0e1ed728464af5921cc33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab090cc189cdffbee5fe7de3067cb540466b38d11521ef62107827ae06792b082555edf62c0e2172031187dccba9400ef76de6595e8baf5d39a02c395f7c316
|
7
|
+
data.tar.gz: d1c6acb4441885dda5f768728f1316d2fd699c91aa5b8b892200f0c34b161ab6082688c60493ed41c09036e95aebe8ce25c3914fc5bdb054ea8241f468bfaa1f
|
@@ -8,7 +8,7 @@ module VagrantPlugins
|
|
8
8
|
module Action
|
9
9
|
# This action packages a running mos-based server into an
|
10
10
|
# mos-based vagrant box. It does so by burning the associated
|
11
|
-
# vagrant-mos server instance, into an template via
|
11
|
+
# vagrant-mos server instance, into an template via mos sdk API. Upon
|
12
12
|
# successful template burning, the action will create a .box tarball
|
13
13
|
# writing a Vagrantfile with the fresh template id into it.
|
14
14
|
|
@@ -40,22 +40,11 @@ module VagrantPlugins
|
|
40
40
|
# This block attempts to burn the server instance into an template
|
41
41
|
begin
|
42
42
|
# Get the server object for given machine
|
43
|
-
#server = env[:mos_compute].servers.get(env[:machine].id)
|
44
43
|
server = (env[:mos_compute].describe_instances([env[:machine].id]))["Instance"]
|
45
44
|
|
46
45
|
env[:ui].info(I18n.t("vagrant_mos.packaging_instance", :instance_id => server["instanceId"]))
|
47
46
|
|
48
|
-
|
49
|
-
result =env[:mos_compute].create_template(server["instanceId"], "template_name", "template_notes")
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# Make the request to MOS to create an template from machine's instance
|
55
|
-
#ami_response = server.service.create_image server.id, "#{server.tags["Name"]} Package - #{Time.now.strftime("%Y%m%d-%H%M%S")}", ""
|
56
|
-
|
57
|
-
# Find ami id
|
58
|
-
# @ami_id = ami_response.data[:body]["imageId"]
|
47
|
+
result =env[:mos_compute].create_template(server["instanceId"], "template_name-#{Time.now.strftime("%Y%m%d-%H%M%S")}")
|
59
48
|
|
60
49
|
# Attempt to burn the mos instance into an template within timeout
|
61
50
|
env[:metrics]["instance_ready_time"] = Util::Timer.time do
|
@@ -65,38 +54,18 @@ module VagrantPlugins
|
|
65
54
|
region_config = env[:machine].provider_config.get_region_config(region)
|
66
55
|
tries = region_config.instance_package_timeout / 2
|
67
56
|
|
68
|
-
#
|
69
|
-
|
70
|
-
# Check the status of the template every 2 seconds until the ami burn timeout has been reached
|
57
|
+
# Check the result of the create_template every 2 seconds until the template burn timeout has been reached
|
71
58
|
begin
|
72
59
|
retryable(:on => Errors::InstancePackageTimeout, :tries => tries) do
|
73
60
|
# If we're interrupted don't worry about waiting
|
74
61
|
next if env[:interrupted]
|
75
62
|
|
76
|
-
# Need to update the ami_obj on each cycle
|
77
|
-
#ami_obj = server.service.images.get(@ami_id)
|
78
|
-
|
79
63
|
# Wait for the server to be ready, raise error if timeout reached
|
80
64
|
if(result["return"] == "True")
|
81
65
|
break
|
82
66
|
else
|
83
67
|
sleep(2)
|
84
68
|
end
|
85
|
-
|
86
|
-
|
87
|
-
=begin
|
88
|
-
server.wait_for(2) {
|
89
|
-
if ami_obj.state == "failed"
|
90
|
-
raise Errors::InstancePackageError,
|
91
|
-
ami_id: ami_obj.id,
|
92
|
-
err: ami_obj.state
|
93
|
-
return
|
94
|
-
else
|
95
|
-
# Successful template burn will result in true here
|
96
|
-
ami_obj.ready?
|
97
|
-
end
|
98
|
-
}
|
99
|
-
=end
|
100
69
|
end
|
101
70
|
rescue Errors::InstancePackageTimeout
|
102
71
|
# Notify the user upon timeout
|
@@ -107,9 +76,6 @@ module VagrantPlugins
|
|
107
76
|
|
108
77
|
env[:ui].info(I18n.t("vagrant_mos.packaging_instance_complete", :time_seconds => env[:metrics]["instance_ready_time"].to_i))
|
109
78
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
79
|
rescue Exception => e
|
114
80
|
raise Errors::MosError, :message => e.message
|
115
81
|
end
|
@@ -207,8 +173,6 @@ module VagrantPlugins
|
|
207
173
|
def template_root
|
208
174
|
MOS.source_root.join("templates")
|
209
175
|
end
|
210
|
-
|
211
|
-
|
212
176
|
end
|
213
177
|
end
|
214
178
|
end
|
data/lib/vagrant-mos/version.rb
CHANGED