rouster 0.7 → 0.41
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 +4 -4
- data/.gitignore +0 -3
- data/README.md +7 -241
- data/Rakefile +18 -55
- data/Vagrantfile +8 -26
- data/lib/rouster.rb +183 -404
- data/lib/rouster/deltas.rb +118 -577
- data/lib/rouster/puppet.rb +34 -209
- data/lib/rouster/testing.rb +59 -366
- data/lib/rouster/tests.rb +19 -70
- data/path_helper.rb +7 -5
- data/rouster.gemspec +1 -3
- data/test/basic.rb +1 -4
- data/test/functional/deltas/test_get_groups.rb +2 -74
- data/test/functional/deltas/test_get_packages.rb +4 -86
- data/test/functional/deltas/test_get_ports.rb +1 -26
- data/test/functional/deltas/test_get_services.rb +4 -43
- data/test/functional/deltas/test_get_users.rb +2 -35
- data/test/functional/puppet/test_facter.rb +1 -41
- data/test/functional/puppet/test_get_puppet_star.rb +68 -0
- data/test/functional/test_caching.rb +1 -5
- data/test/functional/test_dirs.rb +0 -25
- data/test/functional/test_get.rb +6 -10
- data/test/functional/test_inspect.rb +1 -1
- data/test/functional/test_is_file.rb +1 -17
- data/test/functional/test_new.rb +22 -233
- data/test/functional/test_put.rb +11 -9
- data/test/functional/test_restart.rb +4 -1
- data/test/functional/test_run.rb +3 -2
- data/test/puppet/test_apply.rb +11 -13
- data/test/puppet/test_roles.rb +173 -0
- data/test/unit/test_new.rb +0 -88
- data/test/unit/test_parse_ls_string.rb +0 -67
- data/test/unit/testing/test_validate_file.rb +47 -39
- data/test/unit/testing/test_validate_package.rb +10 -36
- metadata +6 -46
- data/.reek +0 -63
- data/.travis.yml +0 -11
- data/Gemfile +0 -17
- data/Gemfile.lock +0 -102
- data/LICENSE +0 -9
- data/examples/aws.rb +0 -85
- data/examples/openstack.rb +0 -61
- data/examples/passthrough.rb +0 -71
- data/lib/rouster/vagrant.rb +0 -311
- data/plugins/aws.rb +0 -347
- data/plugins/openstack.rb +0 -136
- data/test/functional/deltas/test_get_crontab.rb +0 -161
- data/test/functional/deltas/test_get_os.rb +0 -68
- data/test/functional/test_is_in_file.rb +0 -40
- data/test/functional/test_passthroughs.rb +0 -94
- data/test/functional/test_validate_file.rb +0 -131
- data/test/unit/puppet/resources/puppet_run_with_failed_exec +0 -59
- data/test/unit/puppet/resources/puppet_run_with_successful_exec +0 -61
- data/test/unit/puppet/test_get_puppet_star.rb +0 -91
- data/test/unit/puppet/test_puppet_parsing.rb +0 -44
- data/test/unit/testing/resources/osx-launchd +0 -285
- data/test/unit/testing/resources/rhel-systemd +0 -46
- data/test/unit/testing/resources/rhel-systemv +0 -41
- data/test/unit/testing/resources/rhel-upstart +0 -20
- data/test/unit/testing/test_get_services.rb +0 -178
- data/test/unit/testing/test_validate_cron.rb +0 -78
- data/test/unit/testing/test_validate_port.rb +0 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f007fa8cb115a1889737b42c19eb6ab3a1029e
|
4
|
+
data.tar.gz: c58f43def276534730ead0ffb636254805ce8080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6465a1136c9506cb9f6fd7a7dd46d90eb39d30501ab7162d2f1635bad69a6cb349bfd45eb1d183f19abdd5e214cdca81cf02f6337fd2f7f72093bd343644f7d3
|
7
|
+
data.tar.gz: 88f46d185da9d5f61193ca97651d0a16165c05e2b68871fbfb57dc6a219865054c60218682d90cb0bceaff48319b3511906570aec5597de678dd4e1a6ac0daab
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
Rouster
|
2
2
|
======
|
3
3
|
|
4
|
-
[](https://travis-ci.org/chorankates/rouster) [](https://rubygems.org/gems/rouster)
|
5
|
-
|
6
4
|
```rb
|
7
5
|
Rouster.is_a?('abstraction layer for controlling Vagrant virtual machines')
|
8
6
|
=> true
|
@@ -24,48 +22,23 @@ The first implementation of Rouster was in Perl, called [Salesforce::Vagrant](ht
|
|
24
22
|
|
25
23
|
## Requirements
|
26
24
|
|
27
|
-
* [Ruby](http://rubylang.org), version 2.0+ (best attempt made to support 1.8.7 and 1.9.3 as well)
|
28
25
|
* [Vagrant](http://vagrantup.com), version 1.0.5+
|
29
|
-
*
|
30
|
-
|
31
|
-
|
32
|
-
* net-scp
|
33
|
-
* net-ssh
|
34
|
-
* fog (only if using AWS or OpenStack)
|
26
|
+
* a usable Vagrantfile
|
27
|
+
|
28
|
+
Note: Vagrant itself requires VirtualBox or VMWare Fusion (1.0.3+)
|
35
29
|
|
36
30
|
Note: Rouster should work exactly the same on Windows as it does on \*nix and OSX (minus rouster/deltas.rb functionality, at least currently),
|
37
31
|
but no real testing has been done to confirm this. Please file issues as appropriate.
|
38
32
|
|
39
|
-
###
|
40
|
-
|
41
|
-
```sh
|
42
|
-
git clone https://github.com/chorankates/rouster.git
|
43
|
-
cd rouster
|
44
|
-
bundle install # use :aws to pull in fog
|
45
|
-
...
|
46
|
-
irb(main):001:0> require './path_helper.rb'
|
47
|
-
=> true
|
48
|
-
irb(main):002:0> require 'rouster'
|
49
|
-
=> true
|
50
|
-
```
|
51
|
-
|
52
|
-
### From-source installation (latest)
|
33
|
+
### Easiest installation
|
53
34
|
|
54
35
|
```sh
|
55
36
|
git clone https://github.com/chorankates/rouster.git
|
56
37
|
cd rouster
|
57
38
|
rake buildgem
|
58
|
-
gem install
|
59
|
-
...
|
60
|
-
irb(main):001:0> require 'rouster'
|
61
|
-
=> true
|
39
|
+
gem install Rouster-<version>.gem
|
62
40
|
```
|
63
41
|
|
64
|
-
### pre-built gem installation (stable)
|
65
|
-
|
66
|
-
```sh
|
67
|
-
gem install rouster
|
68
|
-
```
|
69
42
|
|
70
43
|
## Using Rouster
|
71
44
|
|
@@ -146,89 +119,6 @@ app.get('/tmp/foo')
|
|
146
119
|
app.destroy()
|
147
120
|
```
|
148
121
|
|
149
|
-
### advanced instantiation (passthroughs!)
|
150
|
-
|
151
|
-
detailed options in ```examples/passthrough.rb```, ```examples/aws.rb``` and ```examples/openstack.rb```
|
152
|
-
|
153
|
-
since Rouster only requires an SSH connection to control a machine, why stop at Vagrant?
|
154
|
-
|
155
|
-
```rb
|
156
|
-
require 'rouster'
|
157
|
-
require 'rouster/plugins/aws'
|
158
|
-
require 'rouster/plugins/openstack'
|
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
|
-
# create a remote OpenStack instance
|
199
|
-
ostack = Rouster.new(
|
200
|
-
:name => 'ostack-testing',
|
201
|
-
:passthrough => {
|
202
|
-
:type => :openstack,
|
203
|
-
:openstack_auth_url => 'http://hostname.domain.com:5000/v2.0/tokens',
|
204
|
-
:openstack_username => 'some_console_user',
|
205
|
-
:openstack_tenant => 'tenant_id',
|
206
|
-
:user => 'some_ssh_userid',
|
207
|
-
:keypair => 'keypair_name',
|
208
|
-
:image_ref => 'c0340afb-577d-4db6-1234-aebdd6d1838f',
|
209
|
-
:flavor_ref => '547d9af5-096c-44a3-1234-7d23162556b8',
|
210
|
-
:openstack_api_key => 'some_api_key',
|
211
|
-
:key => '/path/to/private/key.pem',
|
212
|
-
},
|
213
|
-
:sudo => true, # false by default, enabling requires that sshd is not enforcing 'requiretty'
|
214
|
-
)
|
215
|
-
|
216
|
-
# control a running OpenStack instance
|
217
|
-
openstack_already_running = Rouster.new(
|
218
|
-
:name => 'ostack-copy',
|
219
|
-
:passthrough => {
|
220
|
-
:type => :openstack,
|
221
|
-
:openstack_auth_url => 'http://hostname.domain.com:5000/v2.0/tokens',
|
222
|
-
:openstack_username => 'some_console_user',
|
223
|
-
:openstack_tenant => 'tenant_id',
|
224
|
-
:user => 'ssh_user',
|
225
|
-
:keypair => 'keypair_name',
|
226
|
-
:instance => 'your-instance-id',
|
227
|
-
},
|
228
|
-
)
|
229
|
-
|
230
|
-
```
|
231
|
-
|
232
122
|
### functional puppet test
|
233
123
|
|
234
124
|
```rb
|
@@ -272,130 +162,6 @@ end
|
|
272
162
|
## Base Methods
|
273
163
|
|
274
164
|
```rb
|
275
|
-
irb(main):
|
276
|
-
=>
|
277
|
-
irb(main):002:0> require 'rouster'
|
278
|
-
=> true
|
279
|
-
irb(main):003:0> pp (Rouster.new(:name => 'app').methods - Object.methods).sort
|
280
|
-
=> [
|
281
|
-
[:_run,
|
282
|
-
:cache,
|
283
|
-
:cache_timeout,
|
284
|
-
:check_key_permissions,
|
285
|
-
:connect_ssh_tunnel,
|
286
|
-
:deltas,
|
287
|
-
:destroy,
|
288
|
-
:dir,
|
289
|
-
:dirs,
|
290
|
-
:disconnect_ssh_tunnel,
|
291
|
-
:exitcode,
|
292
|
-
:facts,
|
293
|
-
:facts=,
|
294
|
-
:file,
|
295
|
-
:files,
|
296
|
-
:generate_unique_mac,
|
297
|
-
:get,
|
298
|
-
:get_crontab,
|
299
|
-
:get_groups,
|
300
|
-
:get_output,
|
301
|
-
:get_packages,
|
302
|
-
:get_ports,
|
303
|
-
:get_services,
|
304
|
-
:get_ssh_info,
|
305
|
-
:get_users,
|
306
|
-
:halt,
|
307
|
-
:is_available_via_ssh?,
|
308
|
-
:is_dir?,
|
309
|
-
:is_executable?,
|
310
|
-
:is_file?,
|
311
|
-
:is_group?,
|
312
|
-
:is_in_file?,
|
313
|
-
:is_in_path?,
|
314
|
-
:is_package?,
|
315
|
-
:is_passthrough?,
|
316
|
-
:is_port_active?,
|
317
|
-
:is_port_open?,
|
318
|
-
:is_process_running?,
|
319
|
-
:is_readable?,
|
320
|
-
:is_service?,
|
321
|
-
:is_service_running?,
|
322
|
-
:is_symlink?,
|
323
|
-
:is_user?,
|
324
|
-
:is_user_in_group?,
|
325
|
-
:is_vagrant_running?,
|
326
|
-
:is_writeable?,
|
327
|
-
:logger,
|
328
|
-
:os_type,
|
329
|
-
:output,
|
330
|
-
:package,
|
331
|
-
:parse_ls_string,
|
332
|
-
:passthrough,
|
333
|
-
:put,
|
334
|
-
:rebuild,
|
335
|
-
:restart,
|
336
|
-
:retries,
|
337
|
-
:run,
|
338
|
-
:sandbox_available?,
|
339
|
-
:sandbox_commit,
|
340
|
-
:sandbox_off,
|
341
|
-
:sandbox_on,
|
342
|
-
:sandbox_rollback,
|
343
|
-
:sshkey,
|
344
|
-
:status,
|
345
|
-
:suspend,
|
346
|
-
:traverse_up,
|
347
|
-
:unittest,
|
348
|
-
:up,
|
349
|
-
:uses_sudo?,
|
350
|
-
:vagrant,
|
351
|
-
:vagrantbinary,
|
352
|
-
:vagrantfile]
|
353
|
-
]
|
354
|
-
```
|
355
|
-
|
356
|
-
## AWS methods
|
357
|
-
```rb
|
358
|
-
irb(main):001:0> require './path_helper.rb'
|
359
|
-
=> true
|
360
|
-
irb(main):002:0> require 'rouster'
|
361
|
-
=> true
|
362
|
-
irb(main):003:0> require 'rouster/plugins/aws'
|
363
|
-
=> true
|
364
|
-
irb(main):004:0> pp (Rouster.new(:name => 'aws', :passthrough => { :type => :aws }).methods - Object.methods).sort
|
365
|
-
=> [
|
366
|
-
...
|
367
|
-
:aws_bootstrap,
|
368
|
-
:aws_connect,
|
369
|
-
:aws_connect_to_elb,
|
370
|
-
:aws_describe_instance,
|
371
|
-
:aws_destroy,
|
372
|
-
:aws_get_ami,
|
373
|
-
:aws_get_hostname,
|
374
|
-
:aws_get_instance,
|
375
|
-
:aws_get_ip,
|
376
|
-
:aws_get_metadata,
|
377
|
-
:aws_get_url,
|
378
|
-
:aws_get_userdata,
|
379
|
-
:aws_status,
|
380
|
-
:ec2,
|
381
|
-
:elb,
|
382
|
-
:elb_connect,
|
383
|
-
:find_ssh_elb,
|
384
|
-
:instance_data,
|
385
|
-
...
|
386
|
-
]
|
387
|
-
```
|
388
|
-
|
389
|
-
## Openstack methods
|
390
|
-
|
391
|
-
```rb
|
392
|
-
[
|
393
|
-
:ostack_connect,
|
394
|
-
:ostack_describe_instance,
|
395
|
-
:ostack_destroy,
|
396
|
-
:ostack_get_instance_id,
|
397
|
-
:ostack_get_ip,
|
398
|
-
:ostack_status,
|
399
|
-
:ostack_up
|
400
|
-
]
|
165
|
+
irb(main):003:0> (Rouster.new(:name => 'app').methods - Object.methods).sort
|
166
|
+
=> [:_run, :_vm, :check_key_permissions, :connect_ssh_tunnel, :deltas, :destroy, :dir, :exitcode, :facter, :facts, :file, :generate_unique_mac, :get, :get_catalog, :get_groups, :get_output, :get_packages, :get_ports, :get_puppet_errors, :get_puppet_notices, :get_services, :get_ssh_info, :get_users, :is_available_via_ssh?, :is_dir?, :is_executable?, :is_file?, :is_group?, :is_in_file?, :is_in_path?, :is_package?, :is_passthrough?, :is_port_active?, :is_port_open?, :is_process_running?, :is_readable?, :is_service?, :is_service_running?, :is_user?, :is_user_in_group?, :is_writeable?, :log, :os_type, :output, :parse_catalog, :parse_ls_string, :passthrough, :put, :rebuild, :remove_existing_certs, :restart, :run, :run_puppet, :sshkey, :status, :sudo, :suspend, :traverse_up, :up, :uses_sudo?, :vagrantfile, :verbosity]
|
401
167
|
```
|
data/Rakefile
CHANGED
@@ -1,83 +1,46 @@
|
|
1
1
|
require sprintf('%s/%s', File.dirname(File.expand_path(__FILE__)), 'path_helper')
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake/testtask'
|
4
|
-
require 'reek/rake/task'
|
5
4
|
|
6
|
-
|
7
|
-
task :build do
|
5
|
+
task :buildgem do
|
8
6
|
sh 'gem build rouster.gemspec'
|
9
7
|
end
|
10
8
|
|
11
|
-
desc 'cleanup environment'
|
12
|
-
task :clean do
|
13
|
-
sh 'rm /tmp/rouster-*'
|
14
|
-
end
|
15
|
-
|
16
9
|
task :default do
|
17
10
|
sh 'ruby test/basic.rb'
|
18
11
|
end
|
19
12
|
|
20
|
-
desc 'run the example demo'
|
21
13
|
task :demo do
|
22
14
|
sh 'ruby examples/demo.rb'
|
23
15
|
end
|
24
16
|
|
25
|
-
desc 'rdoc generation'
|
26
17
|
task :doc do
|
27
18
|
sh 'rdoc --line-numbers lib/*'
|
28
19
|
end
|
29
20
|
|
30
21
|
task :examples do
|
31
22
|
Dir['examples/**/*.rb'].each do |example|
|
32
|
-
|
33
|
-
|
23
|
+
sh "ruby #{example}"
|
24
|
+
end
|
34
25
|
end
|
35
26
|
|
36
|
-
|
37
|
-
|
38
|
-
|
27
|
+
Rake::TestTask.new do |t|
|
28
|
+
t.name = 'test'
|
29
|
+
t.libs << 'lib'
|
30
|
+
t.test_files = FileList['test/**/test_*.rb']
|
31
|
+
t.verbose = true
|
39
32
|
end
|
40
33
|
|
41
|
-
|
42
|
-
t.
|
43
|
-
|
44
|
-
t.
|
45
|
-
t.
|
46
|
-
t.fail_on_error = false
|
47
|
-
t.verbose = true
|
34
|
+
Rake::TestTask.new do |t|
|
35
|
+
t.name = 'unit'
|
36
|
+
t.libs << 'lib'
|
37
|
+
t.test_files = FileList['test/unit/**/test_*.rb']
|
38
|
+
t.verbose = true
|
48
39
|
end
|
49
40
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
Rake::TestTask.new do |t|
|
58
|
-
t.name = 'unit'
|
59
|
-
t.description = 'run unit tests'
|
60
|
-
t.libs << 'lib'
|
61
|
-
t.test_files = FileList['test/unit/**/test_*.rb']
|
62
|
-
end
|
63
|
-
|
64
|
-
Rake::TestTask.new(:functional => :vdestroy) do |t|
|
65
|
-
t.description = 'run functional tests'
|
66
|
-
t.libs << 'lib'
|
67
|
-
t.test_files = FileList['test/functional/**/test_*.rb']
|
68
|
-
end
|
69
|
-
|
70
|
-
Rake::TestTask.new(:deltas => :vdestroy) do |t|
|
71
|
-
t.description = 'run delta tests'
|
72
|
-
t.libs << 'lib'
|
73
|
-
t.test_files = FileList['test/functional/deltas/test_*.rb']
|
74
|
-
end
|
75
|
-
|
76
|
-
Rake::TestTask.new do |t|
|
77
|
-
t.name = 'puppet'
|
78
|
-
t.description = 'run puppet tests'
|
79
|
-
t.libs << 'lib'
|
80
|
-
t.test_files = FileList['test/puppet/test*.rb']
|
81
|
-
t.verbose = true
|
82
|
-
end
|
41
|
+
Rake::TestTask.new do |t|
|
42
|
+
t.name = 'functional'
|
43
|
+
t.libs << 'lib'
|
44
|
+
t.test_files = FileList['test/functional/**/test_*.rb']
|
45
|
+
t.verbose = true
|
83
46
|
end
|
data/Vagrantfile
CHANGED
@@ -1,35 +1,17 @@
|
|
1
1
|
# stripped down example piab Vagrantfile for rouster
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
:
|
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
|
-
},
|
12
|
-
|
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
|
-
}
|
3
|
+
box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box'
|
4
|
+
box_name = 'centos6'
|
5
|
+
boxes = [:ppm, :app]
|
24
6
|
|
25
7
|
Vagrant::Config.run do |config|
|
26
|
-
boxes.
|
8
|
+
boxes.each do |box|
|
27
9
|
config.vm.define box do |worker|
|
28
10
|
|
29
|
-
worker.vm.box =
|
30
|
-
worker.vm.box_url =
|
31
|
-
worker.vm.host_name =
|
32
|
-
worker.vm.network :hostonly, sprintf('10.0.1.%s', rand(
|
11
|
+
worker.vm.box = box_name
|
12
|
+
worker.vm.box_url = box_url
|
13
|
+
worker.vm.host_name = box.to_s
|
14
|
+
worker.vm.network :hostonly, sprintf('10.0.1.%s', rand(254))
|
33
15
|
worker.ssh.forward_agent = true
|
34
16
|
|
35
17
|
if box.to_s.eql?('ppm') and File.directory?('../puppet')
|