rouster 0.57 → 0.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +67 -0
- data/README.md +179 -2
- data/Rakefile +8 -7
- data/Vagrantfile +24 -9
- data/examples/aws.rb +85 -0
- data/lib/rouster.rb +128 -61
- data/lib/rouster/deltas.rb +266 -130
- data/lib/rouster/puppet.rb +2 -2
- data/lib/rouster/testing.rb +28 -6
- data/lib/rouster/vagrant.rb +52 -16
- data/path_helper.rb +3 -4
- data/plugins/aws.rb +347 -0
- data/test/functional/deltas/test_get_packages.rb +50 -6
- data/test/functional/test_caching.rb +2 -2
- data/test/functional/test_new.rb +45 -4
- data/test/functional/test_passthroughs.rb +2 -2
- data/test/puppet/test_apply.rb +1 -1
- data/test/unit/test_new.rb +65 -0
- data/test/unit/testing/resources/osx-launchd +285 -0
- data/test/unit/testing/resources/rhel-systemv +40 -0
- data/test/unit/testing/resources/rhel-upstart +20 -0
- data/test/unit/testing/test_get_services.rb +151 -0
- data/test/unit/testing/test_validate_package.rb +36 -10
- metadata +11 -4
- data/test/puppet/test_roles.rb +0 -186
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d37f795615a19e7523b738d759e48f3e61fdc81c
|
4
|
+
data.tar.gz: 898b4400f00d4675061d9dd5e0716fc9a7ec21ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7442ac64dc582dbc03be7aaecc9f481ca7f9d1d0c43608faab5ea3f947ae4a696a0ab1c6d2467223b289e09faa762adfbdd24db8e2d5f8949f174f35922a73d4
|
7
|
+
data.tar.gz: 13e407ab375276b8bf8c2054008668d2471e2be685224b3da62424cd6d92ff83ee3ceddadb6e0388db7df715d5ea654753dece45c374d2ce2348b302f3a26c4e
|
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (3.2.2)
|
5
|
+
excon (0.40.0)
|
6
|
+
fog (1.24.0)
|
7
|
+
fog-brightbox
|
8
|
+
fog-core (~> 1.23)
|
9
|
+
fog-json
|
10
|
+
fog-radosgw (>= 0.0.2)
|
11
|
+
fog-sakuracloud (>= 0.0.4)
|
12
|
+
fog-softlayer
|
13
|
+
ipaddress (~> 0.5)
|
14
|
+
nokogiri (~> 1.5, >= 1.5.11)
|
15
|
+
fog-brightbox (0.5.1)
|
16
|
+
fog-core (~> 1.22)
|
17
|
+
fog-json
|
18
|
+
inflecto
|
19
|
+
fog-core (1.24.0)
|
20
|
+
builder
|
21
|
+
excon (~> 0.38)
|
22
|
+
formatador (~> 0.2)
|
23
|
+
mime-types
|
24
|
+
net-scp (~> 1.1)
|
25
|
+
net-ssh (>= 2.1.3)
|
26
|
+
fog-json (1.0.0)
|
27
|
+
multi_json (~> 1.0)
|
28
|
+
fog-radosgw (0.0.3)
|
29
|
+
fog-core (>= 1.21.0)
|
30
|
+
fog-json
|
31
|
+
fog-xml (>= 0.0.1)
|
32
|
+
fog-sakuracloud (0.1.1)
|
33
|
+
fog-core
|
34
|
+
fog-json
|
35
|
+
fog-softlayer (0.3.20)
|
36
|
+
fog-core
|
37
|
+
fog-json
|
38
|
+
fog-xml (0.1.0)
|
39
|
+
fog-core
|
40
|
+
nokogiri (~> 1.5, >= 1.5.11)
|
41
|
+
formatador (0.2.5)
|
42
|
+
inflecto (0.0.2)
|
43
|
+
ipaddress (0.8.0)
|
44
|
+
json (1.8.1)
|
45
|
+
log4r (1.1.10)
|
46
|
+
mime-types (2.4.1)
|
47
|
+
mini_portile (0.6.0)
|
48
|
+
multi_json (1.10.1)
|
49
|
+
net-scp (1.2.1)
|
50
|
+
net-ssh (>= 2.6.5)
|
51
|
+
net-ssh (2.9.1)
|
52
|
+
nokogiri (1.6.3.1)
|
53
|
+
mini_portile (= 0.6.0)
|
54
|
+
power_assert (0.1.4)
|
55
|
+
test-unit (3.0.2)
|
56
|
+
power_assert
|
57
|
+
|
58
|
+
PLATFORMS
|
59
|
+
ruby
|
60
|
+
|
61
|
+
DEPENDENCIES
|
62
|
+
fog
|
63
|
+
json
|
64
|
+
log4r (~> 1.1.9)
|
65
|
+
net-scp
|
66
|
+
net-ssh
|
67
|
+
test-unit (~> 3.0.0)
|
data/README.md
CHANGED
@@ -29,10 +29,24 @@ The first implementation of Rouster was in Perl, called [Salesforce::Vagrant](ht
|
|
29
29
|
* log4r
|
30
30
|
* net-scp
|
31
31
|
* net-ssh
|
32
|
+
* fog (only if using AWS)
|
32
33
|
|
33
34
|
Note: Rouster should work exactly the same on Windows as it does on \*nix and OSX (minus rouster/deltas.rb functionality, at least currently),
|
34
35
|
but no real testing has been done to confirm this. Please file issues as appropriate.
|
35
36
|
|
37
|
+
### From-source local usage (latest)
|
38
|
+
|
39
|
+
```sh
|
40
|
+
git clone https://github.com/chorankates/rouster.git
|
41
|
+
cd rouster
|
42
|
+
bundle install # use :aws to pull in fog
|
43
|
+
...
|
44
|
+
irb(main):001:0> require './path_helper.rb'
|
45
|
+
=> true
|
46
|
+
irb(main):002:0> require 'rouster'
|
47
|
+
=> true
|
48
|
+
```
|
49
|
+
|
36
50
|
### From-source installation (latest)
|
37
51
|
|
38
52
|
```sh
|
@@ -40,6 +54,9 @@ git clone https://github.com/chorankates/rouster.git
|
|
40
54
|
cd rouster
|
41
55
|
rake buildgem
|
42
56
|
gem install rouster-<version>.gem
|
57
|
+
...
|
58
|
+
irb(main):001:0> require 'rouster'
|
59
|
+
=> true
|
43
60
|
```
|
44
61
|
|
45
62
|
### pre-built gem installation (stable)
|
@@ -130,6 +147,56 @@ app.get('/tmp/foo')
|
|
130
147
|
app.destroy()
|
131
148
|
```
|
132
149
|
|
150
|
+
### advanced instantiation (passthroughs!)
|
151
|
+
|
152
|
+
detailed options in ```examples/passthrough.rb``` and ```examples/aws.rb```
|
153
|
+
|
154
|
+
since Rouster only requires an SSH connection to control a machine, why stop at Vagrant?
|
155
|
+
|
156
|
+
```rb
|
157
|
+
require 'rouster'
|
158
|
+
require 'rouster/plugins/aws'
|
159
|
+
|
160
|
+
# control the machine rouster itself is running on
|
161
|
+
local = Rouster.new(:name => 'local', :passthrough => { :type => :local } }
|
162
|
+
|
163
|
+
# control a remote machine
|
164
|
+
remote = Rouster.new(
|
165
|
+
:name => 'remote',
|
166
|
+
:passthrough => {
|
167
|
+
:type => :remote,
|
168
|
+
:host => 'foo.bar.com',
|
169
|
+
:user => 'keanu',
|
170
|
+
:key => '/path/to/private/key',
|
171
|
+
}
|
172
|
+
|
173
|
+
:sudo => true, # false by default, enabling requires that sshd is not enforcing 'requiretty'
|
174
|
+
)
|
175
|
+
|
176
|
+
# control a running EC2 instance
|
177
|
+
aws_already_running = Rouster.new(
|
178
|
+
:name => 'cloudy',
|
179
|
+
:passthrough => {
|
180
|
+
:type => :aws,
|
181
|
+
:instance => 'your-instance-id',
|
182
|
+
:keypair => 'your-keypair-name',
|
183
|
+
}
|
184
|
+
)
|
185
|
+
|
186
|
+
# start and control an EC2 instance
|
187
|
+
aws_start_me_up = Rouster.new(
|
188
|
+
:name => 'bgates',
|
189
|
+
:passthrough => {
|
190
|
+
:type => :aws,
|
191
|
+
:ami => 'your-ami-id',
|
192
|
+
:security_groups => 'your-security-groups',
|
193
|
+
:key_id => 'your-aws-key-id', # defaults to ${AWS_ACCESS_KEY_ID}
|
194
|
+
:secret_key => 'your-aws-secret-key', # defaults to ${AWS_SECRET_ACCESS_KEY}
|
195
|
+
}
|
196
|
+
)
|
197
|
+
|
198
|
+
```
|
199
|
+
|
133
200
|
### functional puppet test
|
134
201
|
|
135
202
|
```rb
|
@@ -173,6 +240,116 @@ end
|
|
173
240
|
## Base Methods
|
174
241
|
|
175
242
|
```rb
|
176
|
-
irb(main):
|
177
|
-
=>
|
243
|
+
irb(main):001:0> require './path_helper.rb'
|
244
|
+
=> true
|
245
|
+
irb(main):002:0> require 'rouster'
|
246
|
+
=> true
|
247
|
+
irb(main):003:0> pp (Rouster.new(:name => 'app').methods - Object.methods).sort
|
248
|
+
=> [
|
249
|
+
[:_run,
|
250
|
+
:cache,
|
251
|
+
:cache_timeout,
|
252
|
+
:check_key_permissions,
|
253
|
+
:connect_ssh_tunnel,
|
254
|
+
:deltas,
|
255
|
+
:destroy,
|
256
|
+
:dir,
|
257
|
+
:dirs,
|
258
|
+
:disconnect_ssh_tunnel,
|
259
|
+
:exitcode,
|
260
|
+
:facts,
|
261
|
+
:facts=,
|
262
|
+
:file,
|
263
|
+
:files,
|
264
|
+
:generate_unique_mac,
|
265
|
+
:get,
|
266
|
+
:get_crontab,
|
267
|
+
:get_groups,
|
268
|
+
:get_output,
|
269
|
+
:get_packages,
|
270
|
+
:get_ports,
|
271
|
+
:get_services,
|
272
|
+
:get_ssh_info,
|
273
|
+
:get_users,
|
274
|
+
:halt,
|
275
|
+
:is_available_via_ssh?,
|
276
|
+
:is_dir?,
|
277
|
+
:is_executable?,
|
278
|
+
:is_file?,
|
279
|
+
:is_group?,
|
280
|
+
:is_in_file?,
|
281
|
+
:is_in_path?,
|
282
|
+
:is_package?,
|
283
|
+
:is_passthrough?,
|
284
|
+
:is_port_active?,
|
285
|
+
:is_port_open?,
|
286
|
+
:is_process_running?,
|
287
|
+
:is_readable?,
|
288
|
+
:is_service?,
|
289
|
+
:is_service_running?,
|
290
|
+
:is_symlink?,
|
291
|
+
:is_user?,
|
292
|
+
:is_user_in_group?,
|
293
|
+
:is_vagrant_running?,
|
294
|
+
:is_writeable?,
|
295
|
+
:logger,
|
296
|
+
:os_type,
|
297
|
+
:output,
|
298
|
+
:package,
|
299
|
+
:parse_ls_string,
|
300
|
+
:passthrough,
|
301
|
+
:put,
|
302
|
+
:rebuild,
|
303
|
+
:restart,
|
304
|
+
:retries,
|
305
|
+
:run,
|
306
|
+
:sandbox_available?,
|
307
|
+
:sandbox_commit,
|
308
|
+
:sandbox_off,
|
309
|
+
:sandbox_on,
|
310
|
+
:sandbox_rollback,
|
311
|
+
:sshkey,
|
312
|
+
:status,
|
313
|
+
:suspend,
|
314
|
+
:traverse_up,
|
315
|
+
:unittest,
|
316
|
+
:up,
|
317
|
+
:uses_sudo?,
|
318
|
+
:vagrant,
|
319
|
+
:vagrantbinary,
|
320
|
+
:vagrantfile]
|
321
|
+
]
|
322
|
+
```
|
323
|
+
|
324
|
+
## AWS methods
|
325
|
+
```rb
|
326
|
+
irb(main):001:0> require './path_helper.rb'
|
327
|
+
=> true
|
328
|
+
irb(main):002:0> require 'rouster'
|
329
|
+
=> true
|
330
|
+
irb(main):003:0> require 'rouster/plugins/aws'
|
331
|
+
=> true
|
332
|
+
irb(main):004:0> pp (Rouster.new(:name => 'aws', :passthrough => { :type => :aws }).methods - Object.methods).sort
|
333
|
+
=> [
|
334
|
+
...
|
335
|
+
:aws_bootstrap,
|
336
|
+
:aws_connect,
|
337
|
+
:aws_connect_to_elb,
|
338
|
+
:aws_describe_instance,
|
339
|
+
:aws_destroy,
|
340
|
+
:aws_get_ami,
|
341
|
+
:aws_get_hostname,
|
342
|
+
:aws_get_instance,
|
343
|
+
:aws_get_ip,
|
344
|
+
:aws_get_metadata,
|
345
|
+
:aws_get_url,
|
346
|
+
:aws_get_userdata,
|
347
|
+
:aws_status,
|
348
|
+
:ec2,
|
349
|
+
:elb,
|
350
|
+
:elb_connect,
|
351
|
+
:find_ssh_elb,
|
352
|
+
:instance_data,
|
353
|
+
...
|
354
|
+
]
|
178
355
|
```
|
data/Rakefile
CHANGED
@@ -24,12 +24,15 @@ task :examples do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
task :vdestroy do
|
28
|
+
sh 'vagrant destroy -f'
|
29
|
+
end
|
30
|
+
|
27
31
|
task :reek do
|
28
|
-
sh
|
32
|
+
sh 'reek lib/**/*.rb'
|
29
33
|
end
|
30
34
|
|
31
|
-
Rake::TestTask.new do |t|
|
32
|
-
t.name = 'test'
|
35
|
+
Rake::TestTask.new(:test => :vdestroy) do |t|
|
33
36
|
t.libs << 'lib'
|
34
37
|
t.test_files = FileList['test/**/test_*.rb']
|
35
38
|
t.verbose = true
|
@@ -42,15 +45,13 @@ Rake::TestTask.new do |t|
|
|
42
45
|
t.verbose = true
|
43
46
|
end
|
44
47
|
|
45
|
-
Rake::TestTask.new do |t|
|
46
|
-
t.name = 'functional'
|
48
|
+
Rake::TestTask.new(:functional => :vdestroy) do |t|
|
47
49
|
t.libs << 'lib'
|
48
50
|
t.test_files = FileList['test/functional/**/test_*.rb']
|
49
51
|
t.verbose = true
|
50
52
|
end
|
51
53
|
|
52
|
-
Rake::TestTask.new do |t|
|
53
|
-
t.name = 'deltas'
|
54
|
+
Rake::TestTask.new(:deltas => :vdestroy) do |t|
|
54
55
|
t.libs << 'lib'
|
55
56
|
t.test_files = FileList['test/functional/deltas/test_*.rb']
|
56
57
|
t.verbose = true
|
data/Vagrantfile
CHANGED
@@ -1,19 +1,34 @@
|
|
1
1
|
# stripped down example piab Vagrantfile for rouster
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
boxes = {
|
4
|
+
:ppm => {
|
5
|
+
:box_name => 'centos6',
|
6
|
+
:box_url => 'http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box',
|
7
|
+
},
|
8
|
+
:app => {
|
9
|
+
:box_name => 'centos6',
|
10
|
+
:box_url => 'http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box',
|
11
|
+
},
|
7
12
|
|
8
|
-
|
13
|
+
:ubuntu12 => {
|
14
|
+
:box_name => 'ubuntu12',
|
15
|
+
:box_url => 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210.box',
|
16
|
+
},
|
17
|
+
|
18
|
+
:ubuntu13 => {
|
19
|
+
:box_name => 'ubuntu13',
|
20
|
+
:box_url => 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-1310-x64-virtualbox-puppet.box',
|
21
|
+
},
|
22
|
+
|
23
|
+
}
|
9
24
|
|
10
25
|
Vagrant::Config.run do |config|
|
11
|
-
boxes.
|
26
|
+
boxes.each_pair do |box,hash|
|
12
27
|
config.vm.define box do |worker|
|
13
28
|
|
14
|
-
worker.vm.box = box_name
|
15
|
-
worker.vm.box_url = box_url
|
16
|
-
worker.vm.host_name =
|
29
|
+
worker.vm.box = hash[:box_name]
|
30
|
+
worker.vm.box_url = hash[:box_url]
|
31
|
+
worker.vm.host_name = hash[:box_name]
|
17
32
|
worker.vm.network :hostonly, sprintf('10.0.1.%s', rand(253).to_i + 2)
|
18
33
|
worker.ssh.forward_agent = true
|
19
34
|
|
data/examples/aws.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require sprintf('%s/../%s', File.dirname(File.expand_path(__FILE__)), 'path_helper')
|
2
|
+
|
3
|
+
require 'rouster'
|
4
|
+
require 'plugins/aws' # brings in fog and some helpers
|
5
|
+
|
6
|
+
aws_already_running = Rouster.new(
|
7
|
+
:name => 'aws-already-running',
|
8
|
+
:passthrough => {
|
9
|
+
:type => :aws,
|
10
|
+
:instance => 'your-instance-id',
|
11
|
+
:key => sprintf('%s/.ssh/id_rsa-aws', ENV['HOME'])
|
12
|
+
},
|
13
|
+
:verbosity => 1,
|
14
|
+
)
|
15
|
+
|
16
|
+
a = aws_already_running.run('ls -l /etc/hosts; who')
|
17
|
+
|
18
|
+
aws = Rouster.new(
|
19
|
+
:name => 'aws-testing',
|
20
|
+
:sudo => false,
|
21
|
+
:passthrough => {
|
22
|
+
# all required settings
|
23
|
+
:type => :aws,
|
24
|
+
:keypair => 'your-keypair-name',
|
25
|
+
:security_groups => 'integration-testing',
|
26
|
+
:key => sprintf('%s/.ssh/id_rsa-aws', ENV['HOME']),
|
27
|
+
:userdata => 'foo',
|
28
|
+
|
29
|
+
# optional, setting to be explicit
|
30
|
+
:ami => 'your-ami-id',
|
31
|
+
:dns_propagation_sleep => 20,
|
32
|
+
:min_count => 1, # TODO don't know how to actually handle multiple machines.. just do the same thing on all of the hosts?
|
33
|
+
:max_count => 1,
|
34
|
+
:region => 'us-west-2',
|
35
|
+
:size => 't1.micro',
|
36
|
+
:ssh_port => 22,
|
37
|
+
:user => 'ec2-user',
|
38
|
+
|
39
|
+
:key_id => ENV['AWS_ACCESS_KEY_ID'],
|
40
|
+
:secret_key => ENV['AWS_SECRET_ACCESS_KEY'],
|
41
|
+
},
|
42
|
+
:sshtunnel => false,
|
43
|
+
:verbosity => 1,
|
44
|
+
)
|
45
|
+
|
46
|
+
p "up(): #{aws.up}"
|
47
|
+
|
48
|
+
aws_clone = Rouster.new(
|
49
|
+
:name => 'aws-testing-clone',
|
50
|
+
:passthrough => {
|
51
|
+
:type => :aws,
|
52
|
+
:key => sprintf('%s/.ssh/id_rsa-aws', ENV['HOME']),
|
53
|
+
:instance => aws.aws_get_instance,
|
54
|
+
},
|
55
|
+
:verbosity => 1,
|
56
|
+
)
|
57
|
+
|
58
|
+
[ aws, aws_already_running, aws_clone ].each do |a|
|
59
|
+
p "aws_get_ami: #{a.aws_get_ami}"
|
60
|
+
p "aws_get_instance: #{a.aws_get_instance}"
|
61
|
+
|
62
|
+
p "status: #{a.status}"
|
63
|
+
p "aws_status: #{a.aws_status}" # TODO merge this into status
|
64
|
+
|
65
|
+
p "aws_get_ip(:internal, :public): #{a.aws_get_ip(:internal, :public)}"
|
66
|
+
p "aws_get_ip(:internal, :private): #{a.aws_get_ip(:internal, :private)}"
|
67
|
+
p "aws_get_ip(:aws, :public): #{a.aws_get_ip(:aws, :public)}"
|
68
|
+
p "aws_get_ip(:aws, :private): #{a.aws_get_ip(:aws, :private)}"
|
69
|
+
|
70
|
+
p "aws_get_hostname(:internal, :public): #{a.aws_get_hostname(:internal, :public)}"
|
71
|
+
p "aws_get_hostname(:internal, :private): #{a.aws_get_hostname(:internal, :private)}"
|
72
|
+
p "aws_get_hostname(:aws, :public): #{a.aws_get_hostname(:aws, :public)}"
|
73
|
+
p "aws_get_hostname(:aws, :private): #{a.aws_get_hostname(:aws, :private)}"
|
74
|
+
|
75
|
+
p "run(uptime): #{a.run('uptime')}"
|
76
|
+
p "get(/etc/hosts): #{a.get('/etc/hosts')}"
|
77
|
+
p "put(/etc/hosts, /tmp): #{a.put('/etc/hosts', '/tmp')}"
|
78
|
+
|
79
|
+
p "aws_get_userdata: #{a.aws_get_userdata}"
|
80
|
+
p "aws_get_metadata: #{a.aws_get_metadata}"
|
81
|
+
|
82
|
+
p 'DBGZ' if nil?
|
83
|
+
end
|
84
|
+
|
85
|
+
exit
|