rouster 0.7 → 0.41
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -15,26 +15,8 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
15
15
|
fake_facts = { 'is_virtual' => 'true', 'timezone' => 'PDT', 'uptime_days' => 42 }
|
16
16
|
|
17
17
|
fake_packages = {
|
18
|
-
'abrt' =>
|
19
|
-
|
20
|
-
:arch => 'x86_64',
|
21
|
-
},
|
22
|
-
|
23
|
-
'usermode' => {
|
24
|
-
:version => '1.102-3',
|
25
|
-
:arch => 'noarch',
|
26
|
-
},
|
27
|
-
|
28
|
-
'glibc' => [
|
29
|
-
{
|
30
|
-
:version => '2.12-1.132',
|
31
|
-
:arch => 'x86_64',
|
32
|
-
},
|
33
|
-
{
|
34
|
-
:version => '2.12-1.132',
|
35
|
-
:arch => 'i686',
|
36
|
-
}
|
37
|
-
]
|
18
|
+
'abrt' => '2.0.8-15.el6.centos.x86_64',
|
19
|
+
'usermode' => '1.102-3',
|
38
20
|
}
|
39
21
|
|
40
22
|
@app = Rouster.new(:name => 'app', :unittest => true)
|
@@ -47,8 +29,7 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
47
29
|
assert(@app.validate_package('abrt', { :ensure => true, :version => '2.0.8-15.el6.centos.x86_64' } ))
|
48
30
|
assert(@app.validate_package('abrt', { :ensure => 'present' } ))
|
49
31
|
assert(@app.validate_package('abrt', { :exists => true } ))
|
50
|
-
assert(@app.validate_package('abrt', { :version => '> 1.0'
|
51
|
-
assert(@app.validate_package('abrt', { :arch => 'x86_64' } ))
|
32
|
+
assert(@app.validate_package('abrt', { :version => '> 1.0'} ))
|
52
33
|
|
53
34
|
assert(@app.validate_package('usermode', { :version => '1.102-3' } ))
|
54
35
|
assert(@app.validate_package('usermode', { :version => '> 0.5' } )) # specifying 1 here fails because 1.102-3.to_i is 1
|
@@ -56,23 +37,14 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
56
37
|
assert(@app.validate_package('usermode', { :version => '< 5.0' } ))
|
57
38
|
|
58
39
|
assert(@app.validate_package('hds', { :exists => false } ))
|
59
|
-
assert(@app.validate_package('hds', { :ensure => 'absent'}
|
40
|
+
assert(@app.validate_package('hds', { :ensure => 'absent'}))
|
60
41
|
|
61
42
|
end
|
62
43
|
|
63
44
|
def test_positive_constrained
|
64
|
-
assert(@app.validate_package('abrt', { :ensure => true, :constrain => 'is_virtual true' } ))
|
65
|
-
end
|
66
45
|
|
67
|
-
|
68
|
-
# determine whether a package is installed with a particular arch, while remaining flexible
|
69
|
-
assert(@app.validate_package('glibc', { :ensure => true, :arch => 'x86_64' } ))
|
70
|
-
assert(@app.validate_package('glibc', { :ensure => true, :arch => 'i686' } ))
|
71
|
-
assert(@app.validate_package('glibc', { :ensure => true, :arch => [ 'i686', 'x86_64' ] } ))
|
72
|
-
assert(@app.validate_package('glibc', { :ensure => true } ))
|
46
|
+
assert(@app.validate_package('abrt', { :ensure => true, :constrain => 'is_virtual true' } ))
|
73
47
|
|
74
|
-
assert_equal(false, @app.validate_package('glibc', { :ensure => true, :arch => [ 'noarch' ] } ))
|
75
|
-
assert_equal(false, @app.validate_package('glibc', { :ensure => true, :arch => 'review' } ))
|
76
48
|
end
|
77
49
|
|
78
50
|
def test_negative_basic
|
@@ -80,12 +52,14 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
80
52
|
assert_equal(false, @app.validate_package('abrt', { :version => 'foo.bar'} ))
|
81
53
|
assert_equal(false, @app.validate_package('abrt', { :ensure => 'absent' } ))
|
82
54
|
assert_equal(false, @app.validate_package('abrt', { :exists => false } ))
|
83
|
-
|
55
|
+
|
84
56
|
end
|
85
57
|
|
86
58
|
def test_negative_constrained
|
87
|
-
|
88
|
-
assert(@app.validate_package('abrt', { :ensure =>
|
59
|
+
|
60
|
+
assert(@app.validate_package('abrt', { :ensure => false, :constrain => 'is_virtual false' }))
|
61
|
+
assert(@app.validate_package('abrt', { :ensure => true, :constrain => 'is_virtual false' }))
|
62
|
+
|
89
63
|
end
|
90
64
|
|
91
65
|
def teardown
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rouster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.41'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conor Horan-Kates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -82,20 +82,6 @@ dependencies:
|
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: test-unit
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ~>
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: reek
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - '>='
|
@@ -116,39 +102,27 @@ extensions: []
|
|
116
102
|
extra_rdoc_files: []
|
117
103
|
files:
|
118
104
|
- .gitignore
|
119
|
-
- .reek
|
120
|
-
- .travis.yml
|
121
|
-
- Gemfile
|
122
|
-
- Gemfile.lock
|
123
|
-
- LICENSE
|
124
105
|
- README.md
|
125
106
|
- Rakefile
|
126
107
|
- Vagrantfile
|
127
|
-
- examples/aws.rb
|
128
108
|
- examples/bootstrap.rb
|
129
109
|
- examples/demo.rb
|
130
110
|
- examples/error.rb
|
131
|
-
- examples/openstack.rb
|
132
|
-
- examples/passthrough.rb
|
133
111
|
- lib/rouster.rb
|
134
112
|
- lib/rouster/deltas.rb
|
135
113
|
- lib/rouster/puppet.rb
|
136
114
|
- lib/rouster/testing.rb
|
137
115
|
- lib/rouster/tests.rb
|
138
|
-
- lib/rouster/vagrant.rb
|
139
116
|
- path_helper.rb
|
140
|
-
- plugins/aws.rb
|
141
|
-
- plugins/openstack.rb
|
142
117
|
- rouster.gemspec
|
143
118
|
- test/basic.rb
|
144
|
-
- test/functional/deltas/test_get_crontab.rb
|
145
119
|
- test/functional/deltas/test_get_groups.rb
|
146
|
-
- test/functional/deltas/test_get_os.rb
|
147
120
|
- test/functional/deltas/test_get_packages.rb
|
148
121
|
- test/functional/deltas/test_get_ports.rb
|
149
122
|
- test/functional/deltas/test_get_services.rb
|
150
123
|
- test/functional/deltas/test_get_users.rb
|
151
124
|
- test/functional/puppet/test_facter.rb
|
125
|
+
- test/functional/puppet/test_get_puppet_star.rb
|
152
126
|
- test/functional/test_caching.rb
|
153
127
|
- test/functional/test_destroy.rb
|
154
128
|
- test/functional/test_dirs.rb
|
@@ -157,9 +131,7 @@ files:
|
|
157
131
|
- test/functional/test_inspect.rb
|
158
132
|
- test/functional/test_is_dir.rb
|
159
133
|
- test/functional/test_is_file.rb
|
160
|
-
- test/functional/test_is_in_file.rb
|
161
134
|
- test/functional/test_new.rb
|
162
|
-
- test/functional/test_passthroughs.rb
|
163
135
|
- test/functional/test_put.rb
|
164
136
|
- test/functional/test_rebuild.rb
|
165
137
|
- test/functional/test_restart.rb
|
@@ -167,7 +139,6 @@ files:
|
|
167
139
|
- test/functional/test_status.rb
|
168
140
|
- test/functional/test_suspend.rb
|
169
141
|
- test/functional/test_up.rb
|
170
|
-
- test/functional/test_validate_file.rb
|
171
142
|
- test/puppet/manifests/default.pp
|
172
143
|
- test/puppet/manifests/hiera.yaml
|
173
144
|
- test/puppet/manifests/hieradata/common.json
|
@@ -175,31 +146,20 @@ files:
|
|
175
146
|
- test/puppet/manifests/manifest.pp
|
176
147
|
- test/puppet/modules/role/manifests/ui.pp
|
177
148
|
- test/puppet/test_apply.rb
|
149
|
+
- test/puppet/test_roles.rb
|
178
150
|
- test/tunnel_vs_scp.rb
|
179
|
-
- test/unit/puppet/resources/puppet_run_with_failed_exec
|
180
|
-
- test/unit/puppet/resources/puppet_run_with_successful_exec
|
181
|
-
- test/unit/puppet/test_get_puppet_star.rb
|
182
|
-
- test/unit/puppet/test_puppet_parsing.rb
|
183
151
|
- test/unit/test_generate_unique_mac.rb
|
184
152
|
- test/unit/test_new.rb
|
185
153
|
- test/unit/test_parse_ls_string.rb
|
186
154
|
- test/unit/test_traverse_up.rb
|
187
|
-
- test/unit/testing/resources/osx-launchd
|
188
|
-
- test/unit/testing/resources/rhel-systemd
|
189
|
-
- test/unit/testing/resources/rhel-systemv
|
190
|
-
- test/unit/testing/resources/rhel-upstart
|
191
|
-
- test/unit/testing/test_get_services.rb
|
192
155
|
- test/unit/testing/test_meets_constraint.rb
|
193
|
-
- test/unit/testing/test_validate_cron.rb
|
194
156
|
- test/unit/testing/test_validate_file.rb
|
195
157
|
- test/unit/testing/test_validate_group.rb
|
196
158
|
- test/unit/testing/test_validate_package.rb
|
197
|
-
- test/unit/testing/test_validate_port.rb
|
198
159
|
- test/unit/testing/test_validate_service.rb
|
199
160
|
- test/unit/testing/test_validate_user.rb
|
200
161
|
homepage: http://github.com/chorankates/rouster
|
201
|
-
licenses:
|
202
|
-
- BSD 3-Clause
|
162
|
+
licenses: []
|
203
163
|
metadata: {}
|
204
164
|
post_install_message:
|
205
165
|
rdoc_options: []
|
@@ -217,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
177
|
version: 1.3.6
|
218
178
|
requirements: []
|
219
179
|
rubyforge_project: Rouster
|
220
|
-
rubygems_version: 2.4
|
180
|
+
rubygems_version: 2.0.4
|
221
181
|
signing_key:
|
222
182
|
specification_version: 4
|
223
183
|
summary: Rouster is an abstraction layer for Vagrant
|
data/.reek
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
Attribute:
|
4
|
-
enabled: false
|
5
|
-
|
6
|
-
# so judgy.. and without context
|
7
|
-
BooleanParameter:
|
8
|
-
enabled: false
|
9
|
-
|
10
|
-
ControlParameter:
|
11
|
-
enabled: false
|
12
|
-
|
13
|
-
DataClump:
|
14
|
-
min_clump_size: 4
|
15
|
-
|
16
|
-
DuplicateMethodCall:
|
17
|
-
enabled: false
|
18
|
-
|
19
|
-
# this is not a real thing
|
20
|
-
FeatureEnvy:
|
21
|
-
enabled: false
|
22
|
-
|
23
|
-
# this should have understanding of non-required parameters
|
24
|
-
LongParameterList:
|
25
|
-
max_params: 5
|
26
|
-
|
27
|
-
NestedIterators:
|
28
|
-
max_allowed_nesting: 3
|
29
|
-
|
30
|
-
# you don't know my life
|
31
|
-
NilCheck:
|
32
|
-
enabled: false
|
33
|
-
|
34
|
-
# more lacking context judgement - when _would_ you be ok with '!' ?
|
35
|
-
PrimaDonnaMethod:
|
36
|
-
enabled: false
|
37
|
-
|
38
|
-
# this feels a bit arbitrary.. maybe would make more sense if was an average
|
39
|
-
TooManyStatements:
|
40
|
-
max_statements: 30
|
41
|
-
|
42
|
-
# see above
|
43
|
-
TooManyInstanceVariables:
|
44
|
-
max_instance_variables: 20
|
45
|
-
|
46
|
-
# see above
|
47
|
-
TooManyMethods:
|
48
|
-
max_methods: 20
|
49
|
-
|
50
|
-
# i don't name my exceptions specifically. that doesn't make me a bad person.
|
51
|
-
UncommunicativeVariableName:
|
52
|
-
accept: /^[a|b|e|f|g|h|i|j|k|l|m|p|r|s|u|v]$/
|
53
|
-
|
54
|
-
# or my comparators in ~sort() functions
|
55
|
-
## https://github.com/troessner/reek/issues/886
|
56
|
-
UncommunicativeParameterName:
|
57
|
-
accept:
|
58
|
-
- a
|
59
|
-
- b
|
60
|
-
|
61
|
-
# got dinged for using class variables.. how else would you use self.startup?
|
62
|
-
exclude_paths:
|
63
|
-
- test/
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
ruby '2.0.0'
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'json'
|
6
|
-
gem 'log4r', '~> 1.1.9'
|
7
|
-
gem 'net-scp'
|
8
|
-
gem 'net-ssh'
|
9
|
-
gem 'rake', '= 10.4.2'
|
10
|
-
|
11
|
-
group :development do
|
12
|
-
gem 'test-unit', '~> 3.0.0'
|
13
|
-
gem 'reek', '= 3.10.2'
|
14
|
-
end
|
15
|
-
|
16
|
-
gem 'fog', '= 1.24.0', :groups => [:aws, :openstack]
|
17
|
-
|
data/Gemfile.lock
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
ast (2.3.0)
|
5
|
-
axiom-types (0.1.1)
|
6
|
-
descendants_tracker (~> 0.0.4)
|
7
|
-
ice_nine (~> 0.11.0)
|
8
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
9
|
-
builder (3.2.2)
|
10
|
-
codeclimate-engine-rb (0.3.1)
|
11
|
-
virtus (~> 1.0)
|
12
|
-
coercible (1.0.0)
|
13
|
-
descendants_tracker (~> 0.0.1)
|
14
|
-
descendants_tracker (0.0.4)
|
15
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
16
|
-
equalizer (0.0.11)
|
17
|
-
excon (0.40.0)
|
18
|
-
fog (1.24.0)
|
19
|
-
fog-brightbox
|
20
|
-
fog-core (~> 1.23)
|
21
|
-
fog-json
|
22
|
-
fog-radosgw (>= 0.0.2)
|
23
|
-
fog-sakuracloud (>= 0.0.4)
|
24
|
-
fog-softlayer
|
25
|
-
ipaddress (~> 0.5)
|
26
|
-
nokogiri (~> 1.5, >= 1.5.11)
|
27
|
-
fog-brightbox (0.5.1)
|
28
|
-
fog-core (~> 1.22)
|
29
|
-
fog-json
|
30
|
-
inflecto
|
31
|
-
fog-core (1.24.0)
|
32
|
-
builder
|
33
|
-
excon (~> 0.38)
|
34
|
-
formatador (~> 0.2)
|
35
|
-
mime-types
|
36
|
-
net-scp (~> 1.1)
|
37
|
-
net-ssh (>= 2.1.3)
|
38
|
-
fog-json (1.0.0)
|
39
|
-
multi_json (~> 1.0)
|
40
|
-
fog-radosgw (0.0.3)
|
41
|
-
fog-core (>= 1.21.0)
|
42
|
-
fog-json
|
43
|
-
fog-xml (>= 0.0.1)
|
44
|
-
fog-sakuracloud (0.1.1)
|
45
|
-
fog-core
|
46
|
-
fog-json
|
47
|
-
fog-softlayer (0.3.20)
|
48
|
-
fog-core
|
49
|
-
fog-json
|
50
|
-
fog-xml (0.1.0)
|
51
|
-
fog-core
|
52
|
-
nokogiri (~> 1.5, >= 1.5.11)
|
53
|
-
formatador (0.2.5)
|
54
|
-
ice_nine (0.11.2)
|
55
|
-
inflecto (0.0.2)
|
56
|
-
ipaddress (0.8.0)
|
57
|
-
json (1.8.1)
|
58
|
-
log4r (1.1.10)
|
59
|
-
mime-types (2.4.1)
|
60
|
-
mini_portile (0.6.0)
|
61
|
-
multi_json (1.10.1)
|
62
|
-
net-scp (1.2.1)
|
63
|
-
net-ssh (>= 2.6.5)
|
64
|
-
net-ssh (2.9.1)
|
65
|
-
nokogiri (1.6.3.1)
|
66
|
-
mini_portile (= 0.6.0)
|
67
|
-
parser (2.3.3.0)
|
68
|
-
ast (~> 2.2)
|
69
|
-
power_assert (0.1.4)
|
70
|
-
rainbow (2.1.0)
|
71
|
-
rake (10.4.2)
|
72
|
-
reek (3.10.2)
|
73
|
-
codeclimate-engine-rb (~> 0.3.1)
|
74
|
-
parser (~> 2.3, >= 2.3.0.6)
|
75
|
-
rainbow (~> 2.0)
|
76
|
-
test-unit (3.0.2)
|
77
|
-
power_assert
|
78
|
-
thread_safe (0.3.5)
|
79
|
-
virtus (1.0.5)
|
80
|
-
axiom-types (~> 0.1)
|
81
|
-
coercible (~> 1.0)
|
82
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
83
|
-
equalizer (~> 0.0, >= 0.0.9)
|
84
|
-
|
85
|
-
PLATFORMS
|
86
|
-
ruby
|
87
|
-
|
88
|
-
DEPENDENCIES
|
89
|
-
fog (= 1.24.0)
|
90
|
-
json
|
91
|
-
log4r (~> 1.1.9)
|
92
|
-
net-scp
|
93
|
-
net-ssh
|
94
|
-
rake (= 10.4.2)
|
95
|
-
reek (= 3.10.2)
|
96
|
-
test-unit (~> 3.0.0)
|
97
|
-
|
98
|
-
RUBY VERSION
|
99
|
-
ruby 2.0.0p648
|
100
|
-
|
101
|
-
BUNDLED WITH
|
102
|
-
1.13.6
|
data/LICENSE
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
Copyright (c) 2012, Salesforce.com, Inc.
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
-
|
6
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
-
Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
9
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/examples/aws.rb
DELETED
@@ -1,85 +0,0 @@
|
|
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
|