aws-kicker 0.0.6 → 0.0.7
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 +8 -8
- data/aws-kicker.gemspec +2 -2
- data/lib/aws-kicker/version.rb +1 -1
- data/lib/stack.rb +65 -62
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTRkMGFhZGQzY2QxYWY4NTU2Nzg0ZTdhNDFhYjJkMzMwOGUwOThmZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDY1MTAyM2UxNGJmM2EyZGI2ZGU2YzQzYjhmZDc3MWM2MjM3YTVjMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2ZiY2IyN2YwMzVjNzc1Zjg3MTZmZGNmNTg0MjRkYjhlMWI3NjQwMTUzMTZl
|
10
|
+
YTRkZTZjZDZjMTQ3Y2M0MzMxN2M3M2M5Y2ViMDUxMjFmODJmZWJjOGViMTk2
|
11
|
+
NmRhOTBmYmU0MjNkZTFhMjk5OWIzYzA4ZmY0ZGQxMjc3MGM0M2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDYzYWFmYzE0NWZiYjdiOTQ5NDg0MmJmZDQ1YTVhZGVjZDliZjU5ZmI5N2Y0
|
14
|
+
MjM0MjA5MzI5MGMwYmUxNzlhY2ZiNjA2ZjNlYjY5OTVlNWYyZDkxMzJhMWM1
|
15
|
+
YTg2MDM1Yjk3NzcyMzM0YTBhZmVjYjdmNTc1NDcwNzM5MjhjZWU=
|
data/aws-kicker.gemspec
CHANGED
@@ -25,8 +25,8 @@ The guiding principle is that your Stackfile should be shareable & re-useable by
|
|
25
25
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
26
26
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
27
27
|
gem.require_paths = ["lib"]
|
28
|
-
gem.add_development_dependency('rdoc', '~>
|
29
|
-
gem.add_development_dependency('aruba', '~> 0')
|
28
|
+
gem.add_development_dependency('rdoc', '~> 4.2')
|
29
|
+
gem.add_development_dependency('aruba', '~> 0.6')
|
30
30
|
gem.add_development_dependency('rake', '~> 0.9.2')
|
31
31
|
gem.add_development_dependency('gem-release', '~> 0.7')
|
32
32
|
gem.add_dependency('methadone', '~> 1.2')
|
data/lib/aws-kicker/version.rb
CHANGED
data/lib/stack.rb
CHANGED
@@ -33,6 +33,7 @@ module Stack
|
|
33
33
|
|
34
34
|
config[:find_file_paths] = Array.new if config[:find_file_paths].nil?
|
35
35
|
config[:mime_encode_user_data] = true if config[:mime_encode_user_data].nil?
|
36
|
+
config[:maintain_dns] = true if config[:maintain_dns].nil?
|
36
37
|
|
37
38
|
# build out the full config for each node, supplying defaults from the
|
38
39
|
# global config if explicitly supplied
|
@@ -76,68 +77,69 @@ module Stack
|
|
76
77
|
fqdn = role.to_s + '.' + config[:dns_domain]
|
77
78
|
|
78
79
|
if !running_instances[fqdn].nil?
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
# Ubuntu 8.04/Hardy doesn't do full cloud-init, so we have to script setting the hostname
|
84
|
-
libdir = File.realpath(@@gemhome + '/lib')
|
85
|
-
|
86
|
-
bootstrap_abs = Stack.find_file(config, config[:node_details][fqdn][:bootstrap])
|
87
|
-
cloud_config_yaml_abs = Stack.find_file(config, config[:node_details][fqdn][:cloud_config_yaml])
|
88
|
-
|
89
|
-
if config[:mime_encode_user_data]
|
90
|
-
Logger.debug "mime encoding user-data..."
|
91
|
-
multipart_cmd = "#{libdir}/write-mime-multipart #{bootstrap_abs} #{cloud_config_yaml_abs}"
|
92
|
-
user_data = `#{multipart_cmd}`
|
80
|
+
Logger.info "Skipping creation od #{fqdn} instance as it already exists"
|
81
|
+
server = running_instances[fqdn]
|
93
82
|
else
|
94
|
-
# Ubuntu Hardy
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
83
|
+
# Ubuntu 8.04/Hardy doesn't do full cloud-init, so we have to script setting the hostname
|
84
|
+
libdir = File.realpath(@@gemhome + '/lib')
|
85
|
+
|
86
|
+
bootstrap_abs = Stack.find_file(config, config[:node_details][fqdn][:bootstrap])
|
87
|
+
cloud_config_yaml_abs = Stack.find_file(config, config[:node_details][fqdn][:cloud_config_yaml])
|
88
|
+
|
89
|
+
if config[:mime_encode_user_data]
|
90
|
+
Logger.debug "mime encoding user-data..."
|
91
|
+
multipart_cmd = "#{libdir}/write-mime-multipart #{bootstrap_abs} #{cloud_config_yaml_abs}"
|
92
|
+
user_data = `#{multipart_cmd}`
|
93
|
+
else
|
94
|
+
# Ubuntu Hardy seems to struggle with some mime-encoded user-data
|
95
|
+
# so allow the user to forse submitting user-data un-mimed,
|
96
|
+
# in which case we can only pass one file & it must be the bootstrap script
|
97
|
+
Logger.debug "mime encoding user-data disabled, only sending the bootstrap script"
|
98
|
+
user_data = File.read(bootstrap_abs)
|
99
|
+
end
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
if false
|
124
|
-
# create/update the public & private DNS for this host
|
125
|
-
Stack.update_dns(role.to_s + '-public.' + config[:dns_domain], server.public_ip_address, config)
|
126
|
-
Stack.update_dns(role.to_s + '-private.' + config[:dns_domain], server.private_ip_address, config)
|
127
|
-
|
128
|
-
# create the dns
|
129
|
-
if (role_details[:publish_private_ip] == true && (!role_details[:publish_private_ip].nil?))
|
130
|
-
ip_address = server.private_ip_address
|
131
|
-
else
|
132
|
-
ip_address = server.public_ip_address
|
133
|
-
end
|
134
|
-
Stack.update_dns(fqdn, ip_address, config)
|
135
|
-
#
|
136
|
-
# is this a wildcard DNS host, then claim the *.domain.net
|
137
|
-
if (role_details[:dns_wildcard] == true && (!role_details[:dns_wildcard].nil?))
|
138
|
-
wildcard = "*." + config[:dns_domain]
|
139
|
-
Stack.update_dns(wildcard, ip_address, config)
|
101
|
+
user_data.gsub!(/rentpro-unconfigured/, hostname)
|
102
|
+
user_data.gsub!(/rentpro-stage.local/, config[:dns_domain])
|
103
|
+
|
104
|
+
|
105
|
+
# pp multipart
|
106
|
+
#
|
107
|
+
puts "Bootstraping new instance - #{fqdn}, in #{config[:availability_zone]}, flavor #{config[:node_details][fqdn][:flavor_id]}, image_id #{config[:image_id]}"
|
108
|
+
server = connection.servers.create({
|
109
|
+
:name => fqdn,
|
110
|
+
:hostname => fqdn,
|
111
|
+
:availability_zone => config[:availability_zone],
|
112
|
+
:flavor_id => config[:node_details][fqdn][:flavor_id],
|
113
|
+
:image_id => config[:image_id],
|
114
|
+
:key_name => config[:keypair],
|
115
|
+
:user_data => user_data,
|
116
|
+
:tags => { 'Name' => fqdn },
|
117
|
+
})
|
118
|
+
|
119
|
+
print "Waiting for instance to be ready..."
|
120
|
+
server.wait_for { ready? }
|
121
|
+
puts "#{role.to_s} is booted, #{server.public_ip_address}/#{server.private_ip_address}"
|
140
122
|
end
|
123
|
+
|
124
|
+
if config[:maintain_dns]
|
125
|
+
Logger.info "Updating DNS for #{fqdn}"
|
126
|
+
# create/update the public & private DNS for this host
|
127
|
+
Stack.update_dns(role.to_s + '-public.' + config[:dns_domain], server.public_ip_address, config)
|
128
|
+
Stack.update_dns(role.to_s + '-private.' + config[:dns_domain], server.private_ip_address, config)
|
129
|
+
|
130
|
+
# create the dns
|
131
|
+
if (role_details[:publish_private_ip] == true && (!role_details[:publish_private_ip].nil?))
|
132
|
+
ip_address = server.private_ip_address
|
133
|
+
else
|
134
|
+
ip_address = server.public_ip_address
|
135
|
+
end
|
136
|
+
Stack.update_dns(fqdn, ip_address, config)
|
137
|
+
#
|
138
|
+
# is this a wildcard DNS host, then claim the *.domain.net
|
139
|
+
if (role_details[:dns_wildcard] == true && (!role_details[:dns_wildcard].nil?))
|
140
|
+
wildcard = "*." + config[:dns_domain]
|
141
|
+
Stack.update_dns(wildcard, ip_address, config)
|
142
|
+
end
|
141
143
|
end
|
142
144
|
end
|
143
145
|
end
|
@@ -148,14 +150,15 @@ module Stack
|
|
148
150
|
:aws_access_key_id => config[:aws_access_key_id],
|
149
151
|
:aws_secret_access_key => config[:aws_secret_access_key] })
|
150
152
|
|
151
|
-
|
152
|
-
|
153
|
-
bmtw = dns.zones.get(config[:dns_id])
|
153
|
+
dns.get_hosted_zone(config[:dns_id])
|
154
|
+
bmtw = dns.zones.get(config[:dns_id])
|
154
155
|
|
155
156
|
record = bmtw.records.get(fqdn)
|
156
157
|
if record
|
158
|
+
Logger.info "Updating #{fqdn} with #{ip_address}"
|
157
159
|
record.modify(:value => ip_address) if record
|
158
160
|
else
|
161
|
+
Logger.info "Creating #{fqdn} with #{ip_address}"
|
159
162
|
bmtw.records.create(:value => ip_address, :name => fqdn, :type => 'A')
|
160
163
|
end
|
161
164
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-kicker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon McCartney
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aruba
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.6'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|