instant_ec2 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/instant_ec2.rb +15 -9
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42cfc79bfd329aa789ce68b9d7b955699c9eebfb
|
4
|
+
data.tar.gz: d9af3f8b46f88b3b95f149fa48ac3bb337b6c2da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2b7d7edeaf36e7378a0215bd999fa7ee97227765f4f2c822a927decb164a6e6dc6fd1783d05d46b71d3420548ed417f6ee4d0765bd96304ed52ec8b7ca54e0
|
7
|
+
data.tar.gz: d9526ba7df9a67fe8873c9c520c557c041fd3b70bcd56f6f3d7db39b7d492c591ed3dc046e37be737d9c6ace8ae873e66e88d50242b47be5c45ed6db4fd2f379
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/instant_ec2.rb
CHANGED
@@ -17,7 +17,7 @@ class EC2Instance < Hash
|
|
17
17
|
def start(duration: nil)
|
18
18
|
|
19
19
|
@c.start_instance self[:instance_id]
|
20
|
-
Thread.new{ sleep duration * 60; self.stop} if duration
|
20
|
+
Thread.new{ sleep duration.to_i * 60; self.stop} if duration
|
21
21
|
|
22
22
|
end
|
23
23
|
|
@@ -38,18 +38,24 @@ class InstantEC2
|
|
38
38
|
credentials: Aws::Credentials.new(*credentials))
|
39
39
|
|
40
40
|
r = @ec2.describe_instances.reservations
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
|
42
|
+
ids = @ec2.describe_instances[:reservations].inject({}) do |r, item|
|
43
|
+
x = item.instances[0]
|
44
|
+
r.merge(x.image_id => x.instance_id)
|
45
|
+
end
|
46
|
+
|
47
|
+
rows = @ec2.describe_images(image_ids: ids.keys)[:images].\
|
48
|
+
map{|x| [x.name, x.image_id] }
|
45
49
|
|
46
|
-
@images =
|
50
|
+
@images = rows.inject([]) do |r, x|
|
47
51
|
|
48
|
-
name,
|
49
|
-
|
52
|
+
name, image_id = x
|
53
|
+
|
54
|
+
r << EC2Instance.new({image_name: name, \
|
55
|
+
instance_id: ids[image_id]}, self)
|
50
56
|
|
51
57
|
end
|
52
|
-
|
58
|
+
|
53
59
|
@hooks = {
|
54
60
|
running: ->(ip){
|
55
61
|
puts "%s: the instance is now accessible from %s" % [Time.now, ip]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|