jzimmek-ec2 0.0.4 → 0.0.5
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.
- data/VERSION +1 -1
- data/ec2.gemspec +1 -1
- data/lib/ec2/instance_binding.rb +6 -3
- data/lib/ec2/manager.rb +7 -1
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/ec2.gemspec
CHANGED
data/lib/ec2/instance_binding.rb
CHANGED
@@ -21,12 +21,13 @@ module Ec2
|
|
21
21
|
|
22
22
|
@ssh = Net::SSH.start(@public_dns_name, "root", :keys => [@cloud.ssh_key_file], :paranoid => false)
|
23
23
|
|
24
|
-
user_data = fetch_from_url("http://169.254.169.254/2009-04-04/user-data")
|
24
|
+
# user_data = fetch_from_url("http://169.254.169.254/2009-04-04/user-data")
|
25
25
|
|
26
|
-
@hostname = user_data.index("Not Found") ? nil : user_data
|
26
|
+
# @hostname = user_data.index("Not Found") ? nil : user_data
|
27
|
+
|
28
|
+
@hostname = fetch_from_file("/root/.hostname")
|
27
29
|
|
28
30
|
if @hostname
|
29
|
-
|
30
31
|
Pending.remove(@hostname)
|
31
32
|
|
32
33
|
@public_ip = fetch_from_url("http://169.254.169.254/latest/meta-data/public-ipv4")
|
@@ -78,6 +79,7 @@ module Ec2
|
|
78
79
|
@ssh.exec!("rm #{file}")
|
79
80
|
@ssh.exec!("curl -o #{file} #{url}")
|
80
81
|
value = @ssh.exec!("cat #{file}")
|
82
|
+
value.strip! if value
|
81
83
|
puts "fetch from #{url}: #{value}"
|
82
84
|
@ssh.exec!("rm #{file}")
|
83
85
|
value
|
@@ -86,6 +88,7 @@ module Ec2
|
|
86
88
|
def fetch_from_file(file)
|
87
89
|
@ssh.exec!("touch #{file}")
|
88
90
|
value = @ssh.exec!("cat #{file}")
|
91
|
+
value.strip! if value
|
89
92
|
puts "fetch from #{file}: #{value}"
|
90
93
|
value
|
91
94
|
end
|
data/lib/ec2/manager.rb
CHANGED
@@ -53,12 +53,18 @@ module Ec2
|
|
53
53
|
def startup(instance)
|
54
54
|
|
55
55
|
unless Pending.pending?(instance.name)
|
56
|
+
|
57
|
+
user_data = instance.userdata
|
58
|
+
|
59
|
+
user_data << "\necho \"#{instance.name}\" > /root/.hostname" if user_data
|
60
|
+
|
56
61
|
opts = {
|
57
62
|
:image_id => instance.ami,
|
58
63
|
:min_count => 1,
|
59
64
|
:max_count => 1,
|
60
65
|
:key_name => instance.keypair,
|
61
|
-
:user_data => Base64.encode64(instance.name),
|
66
|
+
# :user_data => Base64.encode64(instance.name),
|
67
|
+
:user_data => Base64.encode64(user_data),
|
62
68
|
:instance_type => "m1.small"
|
63
69
|
}
|
64
70
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jzimmek-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Zimmek
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- test/test_helper.rb
|
38
38
|
has_rdoc: false
|
39
39
|
homepage: http://github.com/jzimmek/ec2
|
40
|
+
licenses:
|
40
41
|
post_install_message:
|
41
42
|
rdoc_options:
|
42
43
|
- --charset=UTF-8
|
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
58
|
requirements: []
|
58
59
|
|
59
60
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.3.5
|
61
62
|
signing_key:
|
62
63
|
specification_version: 3
|
63
64
|
summary: Management tool for EC2 clouds
|