zergrush 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d8acedf70be7adb1d251ac32a9aaf0549b4cf8a
4
- data.tar.gz: 8a409859068d49143531054b27eae205151c6395
3
+ metadata.gz: 8232d3c148df3fff7f7ca7633d6ee37a1ff4b996
4
+ data.tar.gz: 8ec19c8f5a37163de033cc19c5251b1d209e1983
5
5
  SHA512:
6
- metadata.gz: c717e03ced04167092686320a8c0962c204201ba29119ce3fbe86547344dcab4e83a424297ce9385f932e6d223553127d739a032396b8ec8ab61fbaf4cb24c76
7
- data.tar.gz: 853a2d5f031e6f71c9b733c92459002c903de927b22f6226fd180d84e65fb521e1170508e0bb453bec02e1dc0207eb8593a32fa5fce761da3314d454b69e47e0
6
+ metadata.gz: 8c5aeea9a8616b2f14980eec824a0e5520d552b7ccc1c036eb1c2fdf5ac636a2b18810d758739b6485f17ad46f07d293c4c783bed2e078770970616817d03058
7
+ data.tar.gz: 6bd4093c127d9cba6113bb818f0114aa406a798670bc06d9b91fc1ae0f7eadcae90004fd13fef9f47dea0a24845a52bda01e87facf45af027b92d0ae15758cf3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zergrush (0.0.3)
4
+ zergrush (0.0.5)
5
5
  awesome_print
6
6
  highline
7
7
  json-schema
@@ -42,6 +42,7 @@ GEM
42
42
  gherkin (2.12.2)
43
43
  multi_json (~> 1.3)
44
44
  highline (1.6.20)
45
+ ipaddress (0.8.0)
45
46
  json-schema (2.2.1)
46
47
  mime-types (2.0)
47
48
  multi_json (1.8.4)
@@ -70,6 +71,7 @@ GEM
70
71
  ruby-libvirt (~> 0.4.0)
71
72
  vagrant-omnibus (1.2.1)
72
73
  zergrush_vagrant (0.0.1)
74
+ ipaddress
73
75
  vagrant-aws
74
76
  vagrant-libvirt
75
77
  vagrant-omnibus
@@ -81,6 +83,7 @@ DEPENDENCIES
81
83
  aruba
82
84
  bundler (>= 1.0.0)
83
85
  cucumber
86
+ ipaddress
84
87
  rake
85
88
  rspec (~> 2.6)
86
89
  zergrush!
data/data/ke.schema CHANGED
@@ -1,89 +1,151 @@
1
1
  {
2
2
  "type": "object",
3
3
  "properties": {
4
- "instances": {
4
+ "num_instances": {
5
5
  "type": "integer",
6
- "minimum": 0
7
- },
8
- "ram_per_vm": {
9
- "type": "integer",
10
- "minimum": 256
11
- },
12
- "synced_folders": {
13
- "type": "array",
14
- "items": {
15
- "properties": {
16
- "host_path": {
17
- "type": "string"
18
- },
19
- "guest_path": {
20
- "type": "string"
21
- },
22
- "options": {
23
- "type": "array"
24
- }
25
- },
26
- "required": [
27
- "host_path",
28
- "guest_path"
29
- ],
30
- "additionalProperties": false
31
- }
32
- },
33
- "tasks": {
34
- "type": "array",
35
- "minItems": 1,
36
- "items": {
37
- <%= driver_tasks_schema %>
38
- }
6
+ "minimum": 1
39
7
  },
40
8
  "vm": {
41
9
  "type": "object",
42
10
  "properties": {
11
+ "private_ip_range": {
12
+ "type": "string",
13
+ "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/(\\d|[1-2]\\d|3[0-2]))$"
14
+ },
43
15
  "driver": {
44
16
  "type": "object",
45
17
  "properties": {
46
18
  "drivertype": {
47
19
  "type": "string"
48
20
  },
49
- "providertype": {
50
- "type": "string"
51
- },
52
- "provider_options": {
53
- "type": "array"
21
+ "driveroptions": {
22
+ "type": "array",
23
+ "minItems": 1,
24
+ "items": {
25
+ "properties": { <%= driver_options_schema %> }
26
+ }
54
27
  }
55
28
  },
56
29
  "required": [
57
- "drivertype",
58
- "providertype",
59
- "provider_options"
30
+ "drivertype"
60
31
  ],
61
32
  "additionalProperties": false
62
33
  },
63
- "private_network": {
64
- "type": "boolean"
65
- },
66
- "basebox": {
67
- "type": "string"
68
- },
69
- "bridge_description": {
70
- "type": "string"
71
- },
72
- "keepalive": {
73
- "type": "boolean"
74
- }
34
+ "instances": {
35
+ "type": "array",
36
+ "minItems": 1,
37
+ "items": {
38
+ "properties": {
39
+ "basebox": {
40
+ "type": "string"
41
+ },
42
+ "keepalive": {
43
+ "type": "boolean"
44
+ },
45
+ "tasks": {
46
+ "type": "array",
47
+ "minItems": 1,
48
+ "items": {
49
+ "properties": { <%= driver_tasks_schema %> }
50
+ }
51
+ },
52
+ "synced_folders": {
53
+ "type": "array",
54
+ "items": {
55
+ "properties": {
56
+ "host_path": {
57
+ "type": "string"
58
+ },
59
+ "guest_path": {
60
+ "type": "string"
61
+ },
62
+ "additional": {
63
+ "type": "object",
64
+ "properties": { <%= driver_folders_schema %> }
65
+ }
66
+ },
67
+ "required": [
68
+ "host_path",
69
+ "guest_path"
70
+ ],
71
+ "additionalProperties": false
72
+ }
73
+ },
74
+ "forwarded_ports": {
75
+ "type": "array",
76
+ "items": {
77
+ "properties": {
78
+ "guest_port": {
79
+ "type": "integer"
80
+ },
81
+ "host_port": {
82
+ "type": "integer"
83
+ },
84
+ "additional": {
85
+ "type": "object",
86
+ "properties": { <%= driver_ports_schema %> }
87
+ }
88
+ },
89
+ "required": [
90
+ "guest_port",
91
+ "host_port"
92
+ ],
93
+ "additionalProperties": false
94
+ }
95
+ },
96
+ "networks": {
97
+ "type": "array",
98
+ "items": {
99
+ "properties": { <%= driver_networks_schema %> }
100
+ }
101
+ },
102
+ "ssh": {
103
+ "type": "object",
104
+ "items": {
105
+ "properties": {
106
+ "username": {
107
+ "type": "string"
108
+ },
109
+ "host": {
110
+ "type": "string"
111
+ },
112
+ "port": {
113
+ "type": "integer"
114
+ },
115
+ "guest_port": {
116
+ "type": "integer"
117
+ },
118
+ "private_key_path": {
119
+ "type": "string"
120
+ },
121
+ "forward_agent": {
122
+ "type": "boolean"
123
+ },
124
+ "additional": {
125
+ "type": "object",
126
+ "properties": { <%= driver_ssh_schema %> }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ },
132
+ "required": [
133
+ "basebox",
134
+ "tasks"
135
+ ],
136
+ "additionalProperties": false
137
+ }
138
+ }
75
139
  },
76
140
  "required": [
77
141
  "driver",
78
- "private_network",
79
- "basebox"
142
+ "instances"
80
143
  ],
81
144
  "additionalProperties": false
82
145
  }
83
146
  },
84
147
  "required": [
85
- "instances",
86
- "tasks",
148
+ "num_instances",
87
149
  "vm"
88
150
  ],
89
151
  "additionalProperties": false
@@ -10,31 +10,65 @@ Feature: Hive
10
10
  Then the file ".hive/helloworld.ke" should contain:
11
11
  """
12
12
  {
13
- "instances": 3,
14
- "tasks": [
15
- {
16
- "type": "shell",
17
- "inline": "echo \"ZERG RUSH!\""
18
- }
19
- ],
13
+ "num_instances": 3,
20
14
  "vm": {
21
15
  "driver": {
22
16
  "drivertype": "vagrant",
23
- "providertype": "virtualbox",
24
- "provider_options": [
25
- "virtualbox.gui = false",
26
- "virtualbox.memory = 256",
27
- "# adjust for DNS weirdness in ubuntu 12.04",
28
- "virtualbox.customize ['modifyvm', :id, '--natdnsproxy1', 'off']",
29
- "virtualbox.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']",
30
- "# set virtio type on the NIC driver. Better performance for large traffic bursts",
31
- "virtualbox.customize ['modifyvm', :id, '--nictype1', 'virtio']",
32
- "virtualbox.customize ['modifyvm', :id, '--nictype2', 'virtio']",
33
- "virtualbox.customize ['modifyvm', :id, '--nictype3', 'virtio']"
17
+ "driveroptions": [
18
+ {
19
+ "providertype": "virtualbox",
20
+ "provider_options" : {
21
+ "gui": false,
22
+ "memory": 256
23
+ }
24
+ }
34
25
  ]
35
26
  },
36
- "basebox": "http://files.vagrantup.com/precise32.box",
37
- "private_network": true
27
+ "private_ip_range": "192.168.50.0/24",
28
+ "instances": [
29
+ {
30
+ "basebox": "http://files.vagrantup.com/precise32.box",
31
+ "keepalive": true,
32
+ "tasks": [
33
+ {
34
+ "type": "shell",
35
+ "inline": "cd /zerg/hosthome; touch helloworld.result; ping -c 3 192.168.50.1; echo \"ZERG RUSH FIRST!\""
36
+ }
37
+ ],
38
+ "synced_folders": [
39
+ {
40
+ "host_path": "~",
41
+ "guest_path": "/zerg/hosthome"
42
+ }
43
+ ],
44
+ "forwarded_ports": [
45
+ {
46
+ "guest_port": 8080,
47
+ "host_port": 80
48
+ }
49
+ ],
50
+ "networks": [
51
+ {
52
+ "type": "private_network"
53
+ },
54
+ {
55
+ "type": "public_network",
56
+ "bridge": "en1: Wi-Fi (AirPort)"
57
+ }
58
+ ]
59
+
60
+ },
61
+ {
62
+ "basebox": "http://files.vagrantup.com/precise32.box",
63
+ "keepalive": false,
64
+ "tasks": [
65
+ {
66
+ "type": "shell",
67
+ "inline": "echo \"ZERG RUSH OTHERS!\""
68
+ }
69
+ ]
70
+ }
71
+ ]
38
72
  }
39
73
  }
40
74
  """
@@ -42,31 +76,42 @@ Feature: Hive
42
76
  Then the file ".hive/helloaws.ke" should contain:
43
77
  """
44
78
  {
45
- "instances": 3,
46
- "tasks": [
47
- {
48
- "type": "shell",
49
- "inline": "echo \"ZERG RUSH PRIME!\""
50
- }
51
- ],
79
+ "num_instances": 3,
52
80
  "vm": {
53
81
  "driver": {
54
82
  "drivertype": "vagrant",
55
- "providertype": "aws",
56
- "provider_options": [
57
- "aws.instance_type = 't1.micro'",
58
- "aws.access_key_id = \"#{ENV['AWS_ACCESS_KEY_ID']}\"",
59
- "aws.secret_access_key = \"#{ENV['AWS_SECRET_ACCESS_KEY']}\"",
60
- "aws.keypair_name = \"#{ENV['AWS_KEY_PAIR']}\"",
61
- "aws.ami = 'ami-3fec7956'",
62
- "aws.region = 'us-east-1'",
63
- "aws.security_groups = [ \"#{ENV['AWS_SECURITY_GROUP']}\" ]",
64
- "override.ssh.username = 'ubuntu'",
65
- "override.ssh.private_key_path = \"#{ENV['AWS_PRIVATE_KEY_PATH']}\""
83
+ "driveroptions": [
84
+ {
85
+ "providertype": "aws",
86
+ "provider_options" : {
87
+ "instance_type": "t1.micro",
88
+ "access_key_id": "#{ENV['AWS_ACCESS_KEY_ID']}",
89
+ "secret_access_key": "#{ENV['AWS_SECRET_ACCESS_KEY']}",
90
+ "keypair_name": "#{ENV['AWS_KEY_PAIR']}",
91
+ "ami": "ami-3fec7956",
92
+ "region": "us-east-1",
93
+ "security_groups": [ "#{ENV['AWS_SECURITY_GROUP']}" ]
94
+ }
95
+ }
66
96
  ]
67
97
  },
68
- "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
69
- "private_network": false
98
+ "private_ip_range": "192.168.50.0/24",
99
+ "instances": [
100
+ {
101
+ "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
102
+ "keepalive": false,
103
+ "tasks": [
104
+ {
105
+ "type": "shell",
106
+ "inline": "echo \"ZERG RUSH PRIME!\""
107
+ }
108
+ ],
109
+ "ssh": {
110
+ "username": "ubuntu",
111
+ "private_key_path": "#{ENV['AWS_PRIVATE_KEY_PATH']}"
112
+ }
113
+ }
114
+ ]
70
115
  }
71
116
  }
72
117
  """
@@ -98,23 +143,31 @@ Feature: Hive
98
143
  Given a file named "arubatask.ke" with:
99
144
  """
100
145
  {
101
- "instances": 1,
102
- "tasks": [
103
- {
104
- "type": "shell",
105
- "inline": "echo \"ARRRRRRRUUUUUBAAAAAAAA!\""
106
- }
107
- ],
146
+ "num_instances": 1,
108
147
  "vm": {
109
148
  "driver": {
110
149
  "drivertype": "vagrant",
111
- "providertype": "aws",
112
- "provider_options": [
113
- "aws.instance_type = 't1.micro'"
150
+ "driveroptions": [
151
+ {
152
+ "providertype": "aws",
153
+ "provider_options" : {
154
+ "instance_type": "t1.micro"
155
+ }
156
+ }
114
157
  ]
115
158
  },
116
- "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
117
- "private_network": false
159
+ "instances": [
160
+ {
161
+ "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
162
+ "keepalive": false,
163
+ "tasks": [
164
+ {
165
+ "type": "shell",
166
+ "inline": "echo \"ARRRRRUUUUUUUUUUUBAAAAA!\""
167
+ }
168
+ ]
169
+ }
170
+ ]
118
171
  }
119
172
  }
120
173
  """
@@ -165,31 +218,65 @@ Feature: Hive
165
218
  Then the file "overriden/hive/dir/.hive/helloworld.ke" should contain:
166
219
  """
167
220
  {
168
- "instances": 3,
169
- "tasks": [
170
- {
171
- "type": "shell",
172
- "inline": "echo \"ZERG RUSH!\""
173
- }
174
- ],
221
+ "num_instances": 3,
175
222
  "vm": {
176
223
  "driver": {
177
224
  "drivertype": "vagrant",
178
- "providertype": "virtualbox",
179
- "provider_options": [
180
- "virtualbox.gui = false",
181
- "virtualbox.memory = 256",
182
- "# adjust for DNS weirdness in ubuntu 12.04",
183
- "virtualbox.customize ['modifyvm', :id, '--natdnsproxy1', 'off']",
184
- "virtualbox.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']",
185
- "# set virtio type on the NIC driver. Better performance for large traffic bursts",
186
- "virtualbox.customize ['modifyvm', :id, '--nictype1', 'virtio']",
187
- "virtualbox.customize ['modifyvm', :id, '--nictype2', 'virtio']",
188
- "virtualbox.customize ['modifyvm', :id, '--nictype3', 'virtio']"
225
+ "driveroptions": [
226
+ {
227
+ "providertype": "virtualbox",
228
+ "provider_options" : {
229
+ "gui": false,
230
+ "memory": 256
231
+ }
232
+ }
189
233
  ]
190
234
  },
191
- "basebox": "http://files.vagrantup.com/precise32.box",
192
- "private_network": true
235
+ "private_ip_range": "192.168.50.0/24",
236
+ "instances": [
237
+ {
238
+ "basebox": "http://files.vagrantup.com/precise32.box",
239
+ "keepalive": true,
240
+ "tasks": [
241
+ {
242
+ "type": "shell",
243
+ "inline": "cd /zerg/hosthome; touch helloworld.result; ping -c 3 192.168.50.1; echo \"ZERG RUSH FIRST!\""
244
+ }
245
+ ],
246
+ "synced_folders": [
247
+ {
248
+ "host_path": "~",
249
+ "guest_path": "/zerg/hosthome"
250
+ }
251
+ ],
252
+ "forwarded_ports": [
253
+ {
254
+ "guest_port": 8080,
255
+ "host_port": 80
256
+ }
257
+ ],
258
+ "networks": [
259
+ {
260
+ "type": "private_network"
261
+ },
262
+ {
263
+ "type": "public_network",
264
+ "bridge": "en1: Wi-Fi (AirPort)"
265
+ }
266
+ ]
267
+
268
+ },
269
+ {
270
+ "basebox": "http://files.vagrantup.com/precise32.box",
271
+ "keepalive": false,
272
+ "tasks": [
273
+ {
274
+ "type": "shell",
275
+ "inline": "echo \"ZERG RUSH OTHERS!\""
276
+ }
277
+ ]
278
+ }
279
+ ]
193
280
  }
194
281
  }
195
282
  """
@@ -197,31 +284,42 @@ Feature: Hive
197
284
  Then the file "overriden/hive/dir/.hive/helloaws.ke" should contain:
198
285
  """
199
286
  {
200
- "instances": 3,
201
- "tasks": [
202
- {
203
- "type": "shell",
204
- "inline": "echo \"ZERG RUSH PRIME!\""
205
- }
206
- ],
287
+ "num_instances": 3,
207
288
  "vm": {
208
289
  "driver": {
209
290
  "drivertype": "vagrant",
210
- "providertype": "aws",
211
- "provider_options": [
212
- "aws.instance_type = 't1.micro'",
213
- "aws.access_key_id = \"#{ENV['AWS_ACCESS_KEY_ID']}\"",
214
- "aws.secret_access_key = \"#{ENV['AWS_SECRET_ACCESS_KEY']}\"",
215
- "aws.keypair_name = \"#{ENV['AWS_KEY_PAIR']}\"",
216
- "aws.ami = 'ami-3fec7956'",
217
- "aws.region = 'us-east-1'",
218
- "aws.security_groups = [ \"#{ENV['AWS_SECURITY_GROUP']}\" ]",
219
- "override.ssh.username = 'ubuntu'",
220
- "override.ssh.private_key_path = \"#{ENV['AWS_PRIVATE_KEY_PATH']}\""
291
+ "driveroptions": [
292
+ {
293
+ "providertype": "aws",
294
+ "provider_options" : {
295
+ "instance_type": "t1.micro",
296
+ "access_key_id": "#{ENV['AWS_ACCESS_KEY_ID']}",
297
+ "secret_access_key": "#{ENV['AWS_SECRET_ACCESS_KEY']}",
298
+ "keypair_name": "#{ENV['AWS_KEY_PAIR']}",
299
+ "ami": "ami-3fec7956",
300
+ "region": "us-east-1",
301
+ "security_groups": [ "#{ENV['AWS_SECURITY_GROUP']}" ]
302
+ }
303
+ }
221
304
  ]
222
305
  },
223
- "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
224
- "private_network": false
306
+ "private_ip_range": "192.168.50.0/24",
307
+ "instances": [
308
+ {
309
+ "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
310
+ "keepalive": false,
311
+ "tasks": [
312
+ {
313
+ "type": "shell",
314
+ "inline": "echo \"ZERG RUSH PRIME!\""
315
+ }
316
+ ],
317
+ "ssh": {
318
+ "username": "ubuntu",
319
+ "private_key_path": "#{ENV['AWS_PRIVATE_KEY_PATH']}"
320
+ }
321
+ }
322
+ ]
225
323
  }
226
324
  }
227
325
  """
@@ -43,25 +43,32 @@ Feature: Tasks
43
43
  Given a file named "arubatask.ke" with:
44
44
  """
45
45
  {
46
- "instances": 1,
47
- "tasks": [
48
- {
49
- "type": "shell",
50
- "inline": "echo \"ZERG RUSH!\""
51
- }
52
- ],
46
+ "num_instances": 1,
53
47
  "vm": {
54
48
  "driver": {
55
49
  "drivertype": "vagrant",
56
- "providertype": "virtualbox",
57
- "provider_options": [
58
- "virtualbox.gui = false",
59
- "virtualbox.memory = 256"
50
+ "driveroptions": [
51
+ {
52
+ "providertype": "virtualbox",
53
+ "provider_options" : {
54
+ "gui": false,
55
+ "memory": 256
56
+ }
57
+ }
60
58
  ]
61
59
  },
62
- "keepalive": true,
63
- "basebox": "http://files.vagrantup.com/precise32.box",
64
- "private_network": false
60
+ "instances": [
61
+ {
62
+ "basebox": "http://files.vagrantup.com/precise32.box",
63
+ "keepalive": true,
64
+ "tasks": [
65
+ {
66
+ "type": "shell",
67
+ "inline": "echo \"ARRRRRRUUUUUUUUUBAAAAAAAA!\""
68
+ }
69
+ ]
70
+ }
71
+ ]
65
72
  }
66
73
  }
67
74
  """
@@ -71,7 +78,9 @@ Feature: Tasks
71
78
  When I run `zerg rush arubatask`
72
79
  Then the output should contain:
73
80
  """
74
- Will leave instances running.
81
+ ARRRRRRUUUUUUUUUBAAAAAAAA!
82
+ zergling_0 is marked as keepalive, skipping halt...
83
+ Some instances were left running.
75
84
  SUCCESS!
76
85
  """
77
86
  And the exit status should be 0
@@ -40,23 +40,8 @@ module Zerg
40
40
 
41
41
  def copy_sample_task
42
42
  load_path = (ENV['HIVE_CWD'] == nil) ? File.join("#{Dir.pwd}", ".hive") : File.join("#{ENV['HIVE_CWD']}", ".hive")
43
- opts = {
44
- :instances => 3,
45
- :drivertype => "vagrant",
46
- :providertype => "virtualbox",
47
- :baseboxpath => "http://files.vagrantup.com/precise32.box",
48
- :privatenetwork => true
49
- }
50
- template("template.ke", "#{File.join(load_path, "helloworld.ke")}", opts)
51
-
52
- opts = {
53
- :instances => 3,
54
- :drivertype => "vagrant",
55
- :providertype => "aws",
56
- :baseboxpath => "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
57
- :privatenetwork => false
58
- }
59
- template("awstemplate.ke", "#{File.join(load_path, "helloaws.ke")}", opts)
43
+ template("template.ke", "#{File.join(load_path, "helloworld.ke")}")
44
+ template("awstemplate.ke", "#{File.join(load_path, "helloaws.ke")}")
60
45
  end
61
46
  end
62
47
  end
@@ -1,28 +1,39 @@
1
1
  {
2
- "instances": <%= config[:instances] %>,
3
- "tasks": [
4
- {
5
- "type": "shell",
6
- "inline": "echo \"ZERG RUSH PRIME!\""
7
- }
8
- ],
2
+ "num_instances": 3,
9
3
  "vm": {
10
4
  "driver": {
11
- "drivertype": "<%= config[:drivertype] %>",
12
- "providertype": "<%= config[:providertype] %>",
13
- "provider_options": [
14
- "<%= config[:providertype] %>.instance_type = 't1.micro'",
15
- "<%= config[:providertype] %>.access_key_id = \"#{ENV['AWS_ACCESS_KEY_ID']}\"",
16
- "<%= config[:providertype] %>.secret_access_key = \"#{ENV['AWS_SECRET_ACCESS_KEY']}\"",
17
- "<%= config[:providertype] %>.keypair_name = \"#{ENV['AWS_KEY_PAIR']}\"",
18
- "<%= config[:providertype] %>.ami = 'ami-3fec7956'",
19
- "<%= config[:providertype] %>.region = 'us-east-1'",
20
- "<%= config[:providertype] %>.security_groups = [ \"#{ENV['AWS_SECURITY_GROUP']}\" ]",
21
- "override.ssh.username = 'ubuntu'",
22
- "override.ssh.private_key_path = \"#{ENV['AWS_PRIVATE_KEY_PATH']}\""
5
+ "drivertype": "vagrant",
6
+ "driveroptions": [
7
+ {
8
+ "providertype": "aws",
9
+ "provider_options" : {
10
+ "instance_type": "t1.micro",
11
+ "access_key_id": "#{ENV['AWS_ACCESS_KEY_ID']}",
12
+ "secret_access_key": "#{ENV['AWS_SECRET_ACCESS_KEY']}",
13
+ "keypair_name": "#{ENV['AWS_KEY_PAIR']}",
14
+ "ami": "ami-3fec7956",
15
+ "region": "us-east-1",
16
+ "security_groups": [ "#{ENV['AWS_SECURITY_GROUP']}" ]
17
+ }
18
+ }
23
19
  ]
24
20
  },
25
- "basebox": "<%= config[:baseboxpath] %>",
26
- "private_network": <%= config[:privatenetwork] %>
21
+ "private_ip_range": "192.168.50.0/24",
22
+ "instances": [
23
+ {
24
+ "basebox": "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box",
25
+ "keepalive": false,
26
+ "tasks": [
27
+ {
28
+ "type": "shell",
29
+ "inline": "echo \"ZERG RUSH PRIME!\""
30
+ }
31
+ ],
32
+ "ssh": {
33
+ "username": "ubuntu",
34
+ "private_key_path": "#{ENV['AWS_PRIVATE_KEY_PATH']}"
35
+ }
36
+ }
37
+ ]
27
38
  }
28
39
  }
@@ -1,28 +1,62 @@
1
1
  {
2
- "instances": <%= config[:instances] %>,
3
- "tasks": [
4
- {
5
- "type": "shell",
6
- "inline": "echo \"ZERG RUSH!\""
7
- }
8
- ],
2
+ "num_instances": 3,
9
3
  "vm": {
10
4
  "driver": {
11
- "drivertype": "<%= config[:drivertype] %>",
12
- "providertype": "<%= config[:providertype] %>",
13
- "provider_options": [
14
- "<%= config[:providertype] %>.gui = false",
15
- "<%= config[:providertype] %>.memory = 256",
16
- "# adjust for DNS weirdness in ubuntu 12.04",
17
- "<%= config[:providertype] %>.customize ['modifyvm', :id, '--natdnsproxy1', 'off']",
18
- "<%= config[:providertype] %>.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']",
19
- "# set virtio type on the NIC driver. Better performance for large traffic bursts",
20
- "<%= config[:providertype] %>.customize ['modifyvm', :id, '--nictype1', 'virtio']",
21
- "<%= config[:providertype] %>.customize ['modifyvm', :id, '--nictype2', 'virtio']",
22
- "<%= config[:providertype] %>.customize ['modifyvm', :id, '--nictype3', 'virtio']"
5
+ "drivertype": "vagrant",
6
+ "driveroptions": [
7
+ {
8
+ "providertype": "virtualbox",
9
+ "provider_options" : {
10
+ "gui": false,
11
+ "memory": 256
12
+ }
13
+ }
23
14
  ]
24
15
  },
25
- "basebox": "<%= config[:baseboxpath] %>",
26
- "private_network": <%= config[:privatenetwork] %>
16
+ "private_ip_range": "192.168.50.0/24",
17
+ "instances": [
18
+ {
19
+ "basebox": "http://files.vagrantup.com/precise32.box",
20
+ "keepalive": true,
21
+ "tasks": [
22
+ {
23
+ "type": "shell",
24
+ "inline": "cd /zerg/hosthome; touch helloworld.result; ping -c 3 192.168.50.1; echo \"ZERG RUSH FIRST!\""
25
+ }
26
+ ],
27
+ "synced_folders": [
28
+ {
29
+ "host_path": "~",
30
+ "guest_path": "/zerg/hosthome"
31
+ }
32
+ ],
33
+ "forwarded_ports": [
34
+ {
35
+ "guest_port": 8080,
36
+ "host_port": 80
37
+ }
38
+ ],
39
+ "networks": [
40
+ {
41
+ "type": "private_network"
42
+ },
43
+ {
44
+ "type": "public_network",
45
+ "bridge": "en1: Wi-Fi (AirPort)"
46
+ }
47
+ ]
48
+
49
+ },
50
+ {
51
+ "basebox": "http://files.vagrantup.com/precise32.box",
52
+ "keepalive": false,
53
+ "tasks": [
54
+ {
55
+ "type": "shell",
56
+ "inline": "echo \"ZERG RUSH OTHERS!\""
57
+ }
58
+ ]
59
+ }
60
+ ]
27
61
  }
28
62
  }
data/lib/zerg/hive.rb CHANGED
@@ -95,11 +95,13 @@ module Zerg
95
95
  pmgr.load
96
96
  abort("ERROR: 'drivertype' is missing from #{ke_file}") unless ke_file_hash["vm"]["driver"]["drivertype"] != nil
97
97
  driver = pmgr.create("/driver/#{ke_file_hash["vm"]["driver"]["drivertype"]}")
98
- driver_schema = driver.task_schema
99
-
100
98
  schema_template = File.open(File.join("#{File.dirname(__FILE__)}", "..", "..", "data", "ke.schema"), 'r').read
101
99
  sources = {
102
- :driver_tasks_schema => driver_schema
100
+ :driver_tasks_schema => driver.task_schema,
101
+ :driver_options_schema => driver.option_schema,
102
+ :driver_folders_schema => driver.folder_schema,
103
+ :driver_ports_schema => driver.port_schema,
104
+ :driver_ssh_schema => driver.ssh_schema
103
105
  }
104
106
  full_schema = JSON.parse(Erbalize.erbalize_hash(schema_template, sources))
105
107
 
@@ -130,16 +132,18 @@ module Zerg
130
132
  pmgr.load
131
133
  abort("ERROR: 'drivertype' is missing from #{ke_file}") unless ke_file_hash["vm"]["driver"]["drivertype"] != nil
132
134
  driver = pmgr.create("/driver/#{ke_file_hash["vm"]["driver"]["drivertype"]}")
133
- driver_schema = driver.task_schema
134
-
135
135
  schema_template = File.open(File.join("#{File.dirname(__FILE__)}", "..", "..", "data", "ke.schema"), 'r').read
136
136
  sources = {
137
- :driver_tasks_schema => driver_schema
137
+ :driver_tasks_schema => driver.task_schema,
138
+ :driver_options_schema => driver.option_schema,
139
+ :driver_folders_schema => driver.folder_schema,
140
+ :driver_ports_schema => driver.port_schema,
141
+ :driver_ssh_schema => driver.ssh_schema
138
142
  }
139
143
  full_schema = JSON.parse(Erbalize.erbalize_hash(schema_template, sources))
140
144
 
141
145
  errors = JSON::Validator.fully_validate(full_schema, ke_file_hash, :errors_as_objects => true)
142
- abort("ERROR: #{ke_file} failed validation. Errors: #{errors.ai}") unless errors.empty?
146
+ abort("ERROR: #{file} failed validation. Errors: #{errors.ai}") unless errors.empty?
143
147
 
144
148
  FileUtils.cp(file, File.join(instance.load_path, File.basename(file)))
145
149
  rescue JSON::ParserError => err
data/lib/zerg/version.rb CHANGED
@@ -22,5 +22,5 @@
22
22
  #++
23
23
 
24
24
  module Zerg
25
- VERSION = "0.0.4"
25
+ VERSION = "0.0.5"
26
26
  end
data/zerg.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency "cucumber"
21
21
  s.add_development_dependency "aruba"
22
22
  s.add_development_dependency "rake"
23
+ s.add_development_dependency "ipaddress"
23
24
 
24
25
  s.add_dependency "awesome_print"
25
26
  s.add_dependency "json-schema"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zergrush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - MTN Satellite Communications
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-20 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ipaddress
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: awesome_print
85
99
  requirement: !ruby/object:Gem::Requirement