engineyard-metadata 0.1.2 → 0.2.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.
- data/README.rdoc +39 -39
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/ey_ssh_aliases +1 -1
- data/engineyard-metadata.gemspec +5 -2
- data/lib/engineyard-metadata.rb +3 -0
- data/lib/engineyard-metadata/amazon_ec2_api.rb +4 -4
- data/lib/engineyard-metadata/chef_dna.rb +25 -38
- data/lib/engineyard-metadata/engine_yard_cloud_api.rb +87 -47
- data/lib/engineyard-metadata/insider.rb +14 -8
- data/lib/engineyard-metadata/metadata.rb +24 -7
- data/lib/engineyard-metadata/outsider.rb +33 -49
- data/lib/engineyard-metadata/ssh_alias_helper.rb +1 -1
- data/spec/metadata_spec.rb +57 -53
- data/spec/spec_helper.rb +6 -7
- data/spec/support/dna.json +184 -119
- data/spec/support/dot.git.config +1 -1
- data/spec/support/engine_yard_cloud_api_response.json +33 -39
- metadata +23 -9
data/spec/spec_helper.rb
CHANGED
@@ -3,12 +3,11 @@ require 'rspec'
|
|
3
3
|
require 'active_support/json/encoding'
|
4
4
|
require 'fakeweb'
|
5
5
|
require 'fakefs/safe'
|
6
|
+
require 'eat' # otherwise it's loaded when fakefs is already active
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
FAKE_CLOUD_TOKEN = 'FAKE_EY_CLOUD_TOKEN'
|
11
|
-
FAKE_ENVIRONMENT_NAME = 'FAKE_ENVIRONMENT_NAME'
|
8
|
+
FAKE_SECURITY_GROUP = 'ey-cm1_production_blue-1294775925-1371-55979'
|
9
|
+
FAKE_INSTANCE_ID = 'i-ff17d493'
|
10
|
+
FAKE_CLOUD_TOKEN = 'justareallygreatsecret'
|
12
11
|
|
13
12
|
def pretend_we_are_on_a_developer_machine
|
14
13
|
FakeWeb.allow_net_connect = false
|
@@ -31,13 +30,13 @@ def pretend_we_are_on_an_engineyard_appcloud_ec2_instance
|
|
31
30
|
FakeWeb.register_uri :get,
|
32
31
|
"http://169.254.169.254/latest/meta-data/security-groups",
|
33
32
|
:status => ["200", "OK"],
|
34
|
-
:body =>
|
33
|
+
:body => FAKE_SECURITY_GROUP
|
35
34
|
|
36
35
|
# fake call to amazon ec2 api to get present instance id
|
37
36
|
FakeWeb.register_uri :get,
|
38
37
|
"http://169.254.169.254/latest/meta-data/instance-id",
|
39
38
|
:status => ["200", "OK"],
|
40
|
-
:body =>
|
39
|
+
:body => FAKE_INSTANCE_ID
|
41
40
|
|
42
41
|
# first read a file from the real file system...
|
43
42
|
dna_json = File.read File.join(File.dirname(__FILE__), 'support', 'dna.json')
|
data/spec/support/dna.json
CHANGED
@@ -2,25 +2,24 @@
|
|
2
2
|
"db_slaves": [
|
3
3
|
|
4
4
|
],
|
5
|
-
"aws_secret_key": "
|
6
|
-
"ruby_version": "Ruby 1.
|
5
|
+
"aws_secret_key": "aidjaoisjaoisdoaisjdoij",
|
6
|
+
"ruby_version": "Ruby 1.9.2",
|
7
7
|
"user_ssh_key": [
|
8
|
-
"ssh-rsa
|
9
|
-
"ssh-rsa
|
10
|
-
"ssh-rsa
|
8
|
+
"ssh-rsa a",
|
9
|
+
"ssh-rsa b",
|
10
|
+
"ssh-rsa c",
|
11
|
+
"ssh-rsa d",
|
12
|
+
"ssh-rsa e"
|
11
13
|
],
|
12
14
|
"backup_interval": 24,
|
13
|
-
"admin_ssh_key": "ssh-rsa
|
14
|
-
"internal_ssh_public_key": "ssh-rsa
|
15
|
-
"internal_ssh_private_key": "-----BEGIN RSA PRIVATE KEY
|
15
|
+
"admin_ssh_key": "ssh-rsa f\n",
|
16
|
+
"internal_ssh_public_key": "ssh-rsa d\n",
|
17
|
+
"internal_ssh_private_key": "-----BEGIN RSA PRIVATE KEY-----ddd-----END RSA PRIVATE KEY-----\n",
|
18
|
+
"mailserver": "smtp.engineyard.com",
|
16
19
|
"utility_instances": [
|
17
|
-
|
18
|
-
"name": "FAKE_ENVIRONMENT_NAME_util_1",
|
19
|
-
"hostname": "internal_util_1.compute-1.internal"
|
20
|
-
}
|
20
|
+
|
21
21
|
],
|
22
22
|
"instance_role": "app_master",
|
23
|
-
"mailserver": "smtp.engineyard.com",
|
24
23
|
"crons": [
|
25
24
|
|
26
25
|
],
|
@@ -28,31 +27,31 @@
|
|
28
27
|
|
29
28
|
],
|
30
29
|
"backup_window": 10,
|
31
|
-
"members": [
|
32
|
-
"internal_app_master.compute-1.internal"
|
33
|
-
],
|
34
|
-
"alert_email": "ALERT-EMAIL",
|
35
30
|
"gems_to_install": [
|
36
31
|
{
|
37
32
|
"name": "rails",
|
38
|
-
"version": "3.0.
|
33
|
+
"version": "3.0.3"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"name": "rails",
|
37
|
+
"version": "3.0.3"
|
39
38
|
}
|
40
39
|
],
|
41
40
|
"applications": {
|
42
|
-
"
|
41
|
+
"cm1_master_blue": {
|
43
42
|
"auth": {
|
44
43
|
"active": false
|
45
44
|
},
|
46
45
|
"newrelic": false,
|
47
46
|
"https_bind_port": 443,
|
48
|
-
"repository_name": "
|
47
|
+
"repository_name": "git@github.com:brighterplanet/cm1.git",
|
49
48
|
"type": "rack",
|
50
49
|
"migration_command": "rake db:migrate",
|
51
50
|
"http_bind_port": 80,
|
52
51
|
"revision": "",
|
53
52
|
"run_deploy": false,
|
54
53
|
"branch": "HEAD",
|
55
|
-
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\
|
54
|
+
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\nijd-----END RSA PRIVATE KEY-----\n",
|
56
55
|
"deploy_action": "deploy",
|
57
56
|
"run_migrations": false,
|
58
57
|
"services": [
|
@@ -72,197 +71,263 @@
|
|
72
71
|
"memcached",
|
73
72
|
"monit",
|
74
73
|
"nginx",
|
75
|
-
"
|
74
|
+
"unicorn"
|
76
75
|
],
|
77
76
|
"vhosts": [
|
78
77
|
{
|
79
78
|
"name": "_",
|
80
|
-
"role": "
|
79
|
+
"role": "cm1_production_blue"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"name": "_",
|
83
|
+
"chain": "-----BEGIN CERTIFICATE-----\r\ndd\r\n-----END CERTIFICATE-----",
|
84
|
+
"role": "cm1_production_blue",
|
85
|
+
"crt": "-----BEGIN CERTIFICATE-----\nsd\n-----END CERTIFICATE-----",
|
86
|
+
"key": "-----BEGIN RSA PRIVATE KEY-----\nsd\n-----END RSA PRIVATE KEY-----"
|
87
|
+
}
|
88
|
+
]
|
89
|
+
},
|
90
|
+
"cm1_certified_blue": {
|
91
|
+
"auth": {
|
92
|
+
"active": false
|
93
|
+
},
|
94
|
+
"newrelic": false,
|
95
|
+
"https_bind_port": 443,
|
96
|
+
"repository_name": "git@github.com:brighterplanet/cm1.git",
|
97
|
+
"type": "rack",
|
98
|
+
"migration_command": "rake db:migrate",
|
99
|
+
"http_bind_port": 80,
|
100
|
+
"revision": "",
|
101
|
+
"run_deploy": false,
|
102
|
+
"branch": "HEAD",
|
103
|
+
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\nsdad\n-----END RSA PRIVATE KEY-----\n",
|
104
|
+
"deploy_action": "deploy",
|
105
|
+
"run_migrations": false,
|
106
|
+
"services": [
|
107
|
+
{
|
108
|
+
"resource": "mongrel",
|
109
|
+
"mongrel_base_port": 5000,
|
110
|
+
"mongrel_mem_limit": 150,
|
111
|
+
"mongrel_instance_count": 3
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"resource": "memcached",
|
115
|
+
"base_port": 11211,
|
116
|
+
"mem_limit": 128
|
117
|
+
}
|
118
|
+
],
|
119
|
+
"recipes": [
|
120
|
+
"memcached",
|
121
|
+
"monit",
|
122
|
+
"nginx",
|
123
|
+
"unicorn"
|
124
|
+
],
|
125
|
+
"vhosts": [
|
126
|
+
{
|
127
|
+
"name": "certified.cm1-production-blue.carbon.brighterplanet.com",
|
128
|
+
"role": "cm1_production_blue"
|
81
129
|
}
|
82
130
|
]
|
83
131
|
}
|
84
132
|
},
|
85
|
-
"
|
133
|
+
"members": [
|
134
|
+
"ip-10-126-17-47.ec2.internal"
|
135
|
+
],
|
136
|
+
"alert_email": "a@a.com",
|
137
|
+
"aws_secret_id": "asdjaoisd",
|
86
138
|
"users": [
|
87
139
|
{
|
88
140
|
"gid": "1000",
|
89
|
-
"username": "
|
141
|
+
"username": "deploy",
|
90
142
|
"uid": "1000",
|
91
143
|
"comment": "",
|
92
144
|
"password": "USERS-0-PASSWORD"
|
93
145
|
}
|
94
146
|
],
|
95
|
-
"environment": {
|
96
|
-
"name": "FAKE_ENVIRONMENT_NAME",
|
97
|
-
"stack": "FAKE_STACK_NAME",
|
98
|
-
"framework_env": "production"
|
99
|
-
},
|
100
147
|
"master_app_server": {
|
101
|
-
"
|
102
|
-
"
|
148
|
+
"public_ip": "ec2-174-129-212-130.compute-1.amazonaws.com",
|
149
|
+
"private_dns_name": "ip-10-126-17-47.ec2.internal"
|
103
150
|
},
|
104
|
-
"
|
151
|
+
"environment": {
|
152
|
+
"name": "cm1_production_blue",
|
153
|
+
"framework_env": "production",
|
154
|
+
"stack": "nginx_unicorn"
|
155
|
+
},
|
156
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/asdasdasdasd",
|
105
157
|
"packages_to_install": [
|
106
|
-
|
107
|
-
"name": "dev-libs/oniguruma"
|
108
|
-
}
|
158
|
+
|
109
159
|
],
|
110
|
-
"db_host": "
|
111
|
-
"haproxy": {
|
112
|
-
"username": "HAPROXY-USERNAME",
|
113
|
-
"password": "HAPROXY-PASSWORD"
|
114
|
-
},
|
160
|
+
"db_host": "ec2-67-202-19-255.compute-1.amazonaws.com",
|
115
161
|
"engineyard": {
|
162
|
+
"this": "i-ff17d493",
|
116
163
|
"environment": {
|
117
164
|
"apps": [
|
118
165
|
{
|
119
|
-
"name": "
|
166
|
+
"name": "cm1_certified_blue",
|
120
167
|
"newrelic": false,
|
121
168
|
"components": [
|
169
|
+
{
|
170
|
+
"collection": [
|
122
171
|
|
172
|
+
],
|
173
|
+
"key": "addons"
|
174
|
+
}
|
123
175
|
],
|
124
|
-
"database_name": "
|
176
|
+
"database_name": "cm1_certified_blue",
|
125
177
|
"migration_command": "rake db:migrate",
|
126
178
|
"type": "rack",
|
127
|
-
"repository_name": "
|
179
|
+
"repository_name": "git@github.com:brighterplanet/cm1.git",
|
128
180
|
"run_deploy": false,
|
129
181
|
"revision": "",
|
130
182
|
"bundled": null,
|
131
183
|
"branch": "HEAD",
|
132
184
|
"run_migrations": false,
|
133
185
|
"deploy_action": "deploy",
|
134
|
-
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\
|
186
|
+
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\nasdasd\n-----END RSA PRIVATE KEY-----\n",
|
135
187
|
"gems": [
|
136
188
|
{
|
137
189
|
"name": "rails",
|
138
|
-
"version": "3.0.
|
190
|
+
"version": "3.0.3",
|
139
191
|
"source": null
|
140
192
|
}
|
141
193
|
],
|
142
194
|
"vhosts": [
|
143
195
|
{
|
144
196
|
"ssl_cert": null,
|
145
|
-
"domain_name": "
|
197
|
+
"domain_name": "certified.cm1-production-blue.carbon.brighterplanet.com"
|
146
198
|
}
|
147
199
|
],
|
148
200
|
"ebuilds": [
|
149
|
-
|
150
|
-
"name": "dev-libs/oniguruma"
|
151
|
-
}
|
201
|
+
|
152
202
|
]
|
153
|
-
}
|
154
|
-
],
|
155
|
-
"aws_secret_key": "AWS-SECRET-KEY",
|
156
|
-
"name": "FAKE_ENVIRONMENT_NAME",
|
157
|
-
"ssh_keys": [
|
158
|
-
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-a",
|
159
|
-
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-b",
|
160
|
-
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-c"
|
161
|
-
],
|
162
|
-
"instances": [
|
203
|
+
},
|
163
204
|
{
|
164
|
-
"name":
|
165
|
-
"
|
205
|
+
"name": "cm1_master_blue",
|
206
|
+
"newrelic": false,
|
166
207
|
"components": [
|
167
208
|
{
|
168
|
-
"
|
209
|
+
"collection": [
|
210
|
+
|
211
|
+
],
|
212
|
+
"key": "addons"
|
169
213
|
}
|
170
214
|
],
|
171
|
-
"
|
172
|
-
"
|
173
|
-
"
|
174
|
-
"
|
175
|
-
"
|
176
|
-
"
|
177
|
-
|
178
|
-
|
179
|
-
"
|
180
|
-
"
|
181
|
-
"
|
215
|
+
"database_name": "cm1_master_blue",
|
216
|
+
"migration_command": "rake db:migrate",
|
217
|
+
"type": "rack",
|
218
|
+
"repository_name": "git@github.com:brighterplanet/cm1.git",
|
219
|
+
"run_deploy": false,
|
220
|
+
"revision": "",
|
221
|
+
"bundled": null,
|
222
|
+
"branch": "HEAD",
|
223
|
+
"run_migrations": false,
|
224
|
+
"deploy_action": "deploy",
|
225
|
+
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\nasdsd\n-----END RSA PRIVATE KEY-----\n",
|
226
|
+
"gems": [
|
182
227
|
{
|
183
|
-
"
|
228
|
+
"name": "rails",
|
229
|
+
"version": "3.0.3",
|
230
|
+
"source": null
|
184
231
|
}
|
185
232
|
],
|
186
|
-
"
|
187
|
-
"enabled": true,
|
188
|
-
"id": "i-app_1",
|
189
|
-
"private_hostname": "internal_app_master.compute-1.internal",
|
190
|
-
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
191
|
-
"awsm_token": "app_1-aws_token"
|
192
|
-
},
|
193
|
-
{
|
194
|
-
"name": null,
|
195
|
-
"public_hostname": "FAKE_DB_MASTER_PUBLIC_HOSTNAME",
|
196
|
-
"components": [
|
233
|
+
"vhosts": [
|
197
234
|
{
|
198
|
-
"
|
235
|
+
"ssl_cert": {
|
236
|
+
"certificate": "-----BEGIN CERTIFICATE-----\n\n-----END CERTIFICATE-----",
|
237
|
+
"certificate_chain": "-----BEGIN CERTIFICATE-----\r\n\r\n-----END CERTIFICATE-----",
|
238
|
+
"private_key": "-----BEGIN RSA PRIVATE KEY-----\n\n-----END RSA PRIVATE KEY-----"
|
239
|
+
},
|
240
|
+
"domain_name": "_"
|
199
241
|
}
|
200
242
|
],
|
201
|
-
"
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
243
|
+
"ebuilds": [
|
244
|
+
|
245
|
+
]
|
246
|
+
}
|
247
|
+
],
|
248
|
+
"aws_secret_key": "BeqxA/9O7/sz3ENzXOwLiSsPsqbHECHdySjZQhIK",
|
249
|
+
"name": "cm1_production_blue",
|
250
|
+
"ssh_keys": [
|
251
|
+
"ssh-rsa a",
|
252
|
+
"ssh-rsa b",
|
253
|
+
"ssh-rsa c",
|
254
|
+
"ssh-rsa d",
|
255
|
+
"ssh-rsa e"
|
256
|
+
],
|
257
|
+
"instances": [
|
208
258
|
{
|
209
259
|
"name": null,
|
210
|
-
"public_hostname": "
|
260
|
+
"public_hostname": "ec2-174-129-212-130.compute-1.amazonaws.com",
|
211
261
|
"components": [
|
212
262
|
{
|
213
263
|
"key": "ssmtp"
|
214
264
|
}
|
215
265
|
],
|
216
|
-
"
|
266
|
+
"stonith_config": {
|
267
|
+
"endpoint_uri": "https://cloud.engineyard.com/stonith",
|
268
|
+
"endpoint_token": "asdasd",
|
269
|
+
"monitor_host": "ip-10-126-17-47.ec2.internal",
|
270
|
+
"endpoint_id": "i-ff17d493"
|
271
|
+
},
|
272
|
+
"role": "app_master",
|
217
273
|
"enabled": true,
|
218
|
-
"id": "i-
|
219
|
-
"private_hostname": "
|
220
|
-
"reporting_url": "https://cloud.engineyard.com/reporting/
|
221
|
-
"awsm_token": "
|
274
|
+
"id": "i-ff17d493",
|
275
|
+
"private_hostname": "ip-10-126-17-47.ec2.internal",
|
276
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/asdasd",
|
277
|
+
"awsm_token": "asasdasd"
|
222
278
|
},
|
223
279
|
{
|
224
|
-
"name":
|
225
|
-
"public_hostname": "
|
280
|
+
"name": null,
|
281
|
+
"public_hostname": "ec2-67-202-19-255.compute-1.amazonaws.com",
|
226
282
|
"components": [
|
227
283
|
{
|
228
284
|
"key": "ssmtp"
|
229
285
|
}
|
230
286
|
],
|
231
|
-
"
|
287
|
+
"stonith_config": {
|
288
|
+
"endpoint_uri": "https://cloud.engineyard.com/stonith",
|
289
|
+
"endpoint_token": "asdasd",
|
290
|
+
"monitor_host": "ip-10-126-17-47.ec2.internal",
|
291
|
+
"endpoint_id": "i-f917d495"
|
292
|
+
},
|
293
|
+
"role": "db_master",
|
232
294
|
"enabled": true,
|
233
|
-
"id": "i-
|
234
|
-
"private_hostname": "
|
235
|
-
"reporting_url": "https://cloud.engineyard.com/reporting/
|
236
|
-
"awsm_token": "
|
295
|
+
"id": "i-f917d495",
|
296
|
+
"private_hostname": "ip-10-126-18-67.ec2.internal",
|
297
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/asdasd",
|
298
|
+
"awsm_token": "asasd"
|
237
299
|
}
|
238
300
|
],
|
239
301
|
"stonith_endpoint": "https://cloud.engineyard.com/stonith",
|
240
302
|
"ruby_version": null,
|
241
303
|
"framework_env": "production",
|
242
304
|
"backup_interval": 24,
|
243
|
-
"admin_ssh_key": "ssh-rsa
|
244
|
-
"internal_ssh_public_key": "ssh-rsa
|
245
|
-
"ssh_username": "
|
246
|
-
"internal_ssh_private_key": "-----BEGIN RSA PRIVATE KEY-----\
|
305
|
+
"admin_ssh_key": "ssh-rsa asdasd\n",
|
306
|
+
"internal_ssh_public_key": "ssh-rsa asdasd \n",
|
307
|
+
"ssh_username": "deploy",
|
308
|
+
"internal_ssh_private_key": "-----BEGIN RSA PRIVATE KEY-----\nasasd-----END RSA PRIVATE KEY-----\n",
|
247
309
|
"mailserver": "smtp.engineyard.com",
|
248
310
|
"components": [
|
249
311
|
{
|
250
|
-
"key": "
|
312
|
+
"key": "ruby_192"
|
251
313
|
}
|
252
314
|
],
|
253
|
-
"stats_password": "STATS-PASSWORD",
|
254
315
|
"crons": [
|
255
316
|
|
256
317
|
],
|
318
|
+
"stats_password": "asdasdasd",
|
257
319
|
"backup_window": 10,
|
258
|
-
"stack_name": "
|
259
|
-
"alert_email": "
|
260
|
-
"ssh_password": "
|
320
|
+
"stack_name": "nginx_unicorn",
|
321
|
+
"alert_email": "a@a.com",
|
322
|
+
"ssh_password": "USERS-0-PASSWORD",
|
261
323
|
"db_stack_name": "mysql",
|
262
|
-
"aws_secret_id": "
|
324
|
+
"aws_secret_id": "asasd",
|
263
325
|
"newrelic_key": null,
|
264
326
|
"monitoring": "monit"
|
265
|
-
}
|
266
|
-
|
327
|
+
}
|
328
|
+
},
|
329
|
+
"haproxy": {
|
330
|
+
"username": "deploy",
|
331
|
+
"password": "asdasasd"
|
267
332
|
}
|
268
333
|
}
|