kitchen-rightscale 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7902c672871b82ac10ebf7f8f8508ee4a49da0cd
4
+ data.tar.gz: a77cf1b19f7fb7c631a7778a4947475967acc0d7
5
+ SHA512:
6
+ metadata.gz: 87d951c99bf8fd5d985d3187f21332023f97743dbc1dc97455574d0843c6d297a21814ede45ce95c95fcf1f70e451e25649a0e9b49a6e7e2e874cc959b951d68
7
+ data.tar.gz: 9a019910f8ed45aec79b1bc5a93ad22c87386243acbff0ec7efd7d9c0b47998a5e168cb087ab6f33017930a8d3d8ce9424f755e120edf81c4759f924cafd0f87
data/.cane ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ AlignParameters:
2
+ Enabled: false
data/.tailor ADDED
@@ -0,0 +1,4 @@
1
+ Tailor.config do |config|
2
+ config.formatters "text"
3
+ config.file_set 'lib/**/*.rb'
4
+ end
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / Unreleased
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Ryan Cragun (<ryan@rightscale.com>)
2
+
3
+ Copyright (C) 2014, Ryan Cragun
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # <a name="title"></a> Kitchen::Rightscale
2
+
3
+ A Test Kitchen Driver for Rightscale.
4
+
5
+ ## <a name="requirements"></a> Requirements
6
+
7
+ **TODO:** document any software or library prerequisites that are required to
8
+ use this driver. Implement the `#verify_dependencies` method in your Driver
9
+ class to enforce these requirements in code, if possible.
10
+
11
+ ## <a name="installation"></a> Installation and Setup
12
+
13
+ Please read the [Driver usage][driver_usage] page for more details.
14
+
15
+ ## <a name="config"></a> Configuration
16
+
17
+ **TODO:** Write descriptions of all configuration options
18
+
19
+ ### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
20
+
21
+ Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
22
+ installed. There are several different behaviors available:
23
+
24
+ * `true` - the latest release will be installed. Subsequent converges
25
+ will skip re-installing if chef is present.
26
+ * `latest` - the latest release will be installed. Subsequent converges
27
+ will always re-install even if chef is present.
28
+ * `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
29
+ be passed the the install.sh script. Subsequent converges will skip if
30
+ the installed version and the desired version match.
31
+ * `false` or `nil` - no chef is installed.
32
+
33
+ The default value is unset, or `nil`.
34
+
35
+ ## <a name="development"></a> Development
36
+
37
+ * Source hosted at [GitHub][repo]
38
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
39
+
40
+ Pull requests are very welcome! Make sure your patches are well tested.
41
+ Ideally create a topic branch for every separate change you make. For
42
+ example:
43
+
44
+ 1. Fork the repo
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
49
+
50
+ ## <a name="authors"></a> Authors
51
+
52
+ Created and maintained by [Ryan Cragun][author] (<ryan@rightscale.com>)
53
+
54
+ ## <a name="license"></a> License
55
+
56
+ Apache 2.0 (see [LICENSE][license])
57
+
58
+
59
+ [author]: https://github.com/enter-github-user
60
+ [issues]: https://github.com/enter-github-user/kitchen-rightscale/issues
61
+ [license]: https://github.com/enter-github-user/kitchen-rightscale/blob/master/LICENSE
62
+ [repo]: https://github.com/enter-github-user/kitchen-rightscale
63
+ [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
64
+ [chef_omnibus_dl]: http://www.getchef.com/chef/install/
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'cane/rake_task'
3
+ require 'tailor/rake_task'
4
+ require 'rubocop/rake_task'
5
+ require 'rspec'
6
+ require 'rspec/core/rake_task'
7
+
8
+ desc 'Run spec suite'
9
+ RSpec::Core::RakeTask.new(:unit) do |task|
10
+ task.pattern = FileList['spec/kitchen/**/*_spec.rb']
11
+ end
12
+
13
+ Rubocop::RakeTask.new do |cop|
14
+ cop.fail_on_error = true
15
+ end
16
+
17
+ desc 'Run cane to check quality metrics'
18
+ Cane::RakeTask.new do |cane|
19
+ cane.canefile = './.cane'
20
+ end
21
+
22
+ Tailor::RakeTask.new
23
+
24
+ desc 'Display LOC stats'
25
+ task :stats do
26
+ puts '\n## Production Code Stats'
27
+ sh 'countloc -r lib'
28
+ end
29
+
30
+ desc 'Run all quality tasks'
31
+ task quality: %i(cane tailor stats unit rubocop)
32
+
33
+ task default: [:quality]
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/driver/rightscale_vagrant_version'
5
+ require 'base64'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'kitchen-rightscale'
9
+ spec.version = Kitchen::Driver::RIGHTSCALE_VAGRANT_VERSION
10
+ spec.authors = ['Ryan Cragun']
11
+ encoded_email = %w(cnlhbkByaWdodHNjYWxlLmNvbQ==)
12
+ spec.email = encoded_email.map { |e| Base64.decode64(e) }
13
+ description = %q{A Test Kitchen Driver and Vagrant Provisioner for }
14
+ description << %q{Rightscale RightImages}
15
+ spec.description = description
16
+ spec.summary = spec.description
17
+ spec.homepage = 'https://www.github.com/ryancragun/kitchen-rightscale'
18
+ spec.license = 'Apache 2.0'
19
+
20
+ spec.files = `git ls-files`.split($RS)
21
+ spec.executables = []
22
+ spec.test_files = spec.files.grep(/^(test|spec|features)/)
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_dependency 'test-kitchen', '~> 1.2.1'
26
+ spec.add_dependency 'kitchen-vagrant', '~> 0.14.0'
27
+
28
+ spec.add_development_dependency 'bundler', '>= 1.3'
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+
32
+ spec.add_development_dependency 'cane'
33
+ spec.add_development_dependency 'tailor'
34
+ spec.add_development_dependency 'countloc'
35
+ spec.add_development_dependency 'pry-rescue'
36
+ spec.add_development_dependency 'rubocop'
37
+ end
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Ryan Cragun (<ryan@rightscale.com>)
4
+ #
5
+ # Copyright (C) 2014, Ryan Cragun
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'kitchen'
20
+ require 'kitchen/driver/vagrant'
21
+
22
+ module Kitchen
23
+ module Driver
24
+ # Rightscale vagrant driver for Kitchen.
25
+ #
26
+ # @author Ryan Cragun <ryan@rightscale.com>
27
+ class RightscaleVagrant < Vagrant
28
+ default_config :rightscale_shim_dir, '/rightscaleshim/default'
29
+ default_config :vagrantfile_erb,
30
+ File.join(File.dirname(__FILE__), 'templates/rsVagrantfile.erb')
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Ryan Cragun (<ryan@rightscale.com>)
4
+ #
5
+ # Copyright (C) 2014, Ryan Cragun
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the 'License');
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an 'AS IS' BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ module Kitchen
20
+ # Vagrant RightScale Driver
21
+ module Driver
22
+ # Version string for Rightscale Kitchen driver
23
+ RIGHTSCALE_VAGRANT_VERSION = '0.1.0'
24
+ end
25
+ end
@@ -0,0 +1,54 @@
1
+ Vagrant.configure("2") do |c|
2
+ c.vm.box = "<%= config[:box] %>"
3
+ c.vm.box_url = "<%= config[:box_url] %>"
4
+
5
+ <% if config[:vm_hostname] %>
6
+ c.vm.hostname = "<%= config[:vm_hostname] %>"
7
+ <% end %>
8
+ <% if config[:guest] %>
9
+ c.vm.guest = <%= config[:guest] %>
10
+ <% end %>
11
+ <% if config[:username] %>
12
+ c.ssh.username = "<%= config[:username] %>"
13
+ <% end %>
14
+ <% if config[:ssh_key] %>
15
+ c.ssh.private_key_path = "<%= config[:ssh_key] %>"
16
+ <% end %>
17
+
18
+ <% Array(config[:network]).each do |opts| %>
19
+ c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
20
+ <% end %>
21
+
22
+ <% if config[:rightscale_shim_dir] %>
23
+ c.rightscaleshim.shim_dir = "<%= config[:rightscale_shim_dir] %>"
24
+ <% end %>
25
+
26
+ c.vm.synced_folder ".", "/vagrant", disabled: true
27
+ <% config[:synced_folders].each do |source, destination, options|
28
+ l_source = source.gsub("%{instance_name}", instance.name)
29
+ l_destination = destination.gsub("%{instance_name}", instance.name)
30
+ opt = (options.nil? ? '' : ", #{options}")
31
+ %>
32
+ c.vm.synced_folder "<%= l_source %>", "<%= l_destination %>"<%= opt %>
33
+ <% end %>
34
+
35
+ c.vm.provider :<%= config[:provider] %> do |p|
36
+ <% config[:customize].each do |key, value| %>
37
+ <% case config[:provider]
38
+ when "virtualbox" %>
39
+ p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"]
40
+ <% when "rackspace" %>
41
+ p.<%= key %> = "<%= value%>"
42
+ <% when /^vmware_/ %>
43
+ <% if key == :memory %>
44
+ <% unless config[:customize].include?(:memsize) %>
45
+ p.vmx["memsize"] = "<%= value %>"
46
+ <% end %>
47
+ <% else %>
48
+ p.vmx["<%= key %>"] = "<%= value %>"
49
+ <% end %>
50
+ <% end %>
51
+ <% end %>
52
+ end
53
+
54
+ end
@@ -0,0 +1,38 @@
1
+ # Author:: Ryan Cragun (<ryan@rightscale.com>)
2
+ #
3
+ # Copyright (C) 2014, Ryan Cragun
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'kitchen'
18
+ require 'kitchen/provisioner/chef_solo'
19
+
20
+ module Kitchen
21
+ module Provisioner
22
+ # RightLink Chef Solo provisioner.
23
+ class ChefRightLink < ChefSolo
24
+ default_config :require_chef_omnibus, false
25
+
26
+ def run_command
27
+ sandbox = '/opt/rightscale/sandbox/bin/'
28
+ [
29
+ sudo("#{sandbox}ruby #{sandbox}chef-solo"),
30
+ "--config #{config[:root_path]}/solo.rb",
31
+ "--json-attributes #{config[:root_path]}/dna.json",
32
+ config[:log_file] ? "--logfile #{config[:log_file]}" : nil,
33
+ "--log_level #{config[:log_level]}"
34
+ ].join(' ')
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module Kitchen
4
+ # ChefRightLink provision spec
5
+ module Provisioner
6
+ describe ChefRightLink do
7
+
8
+ let(:provisioner) do
9
+ Kitchen::Provisioner::ChefRightLink.new
10
+ end
11
+
12
+ it 'uses the sandboxed ruby and chef solo' do
13
+ ruby = %r(^sudo -E /opt/rightscale/sandbox/bin/ruby)
14
+ chef_solo = %r(/opt/rightscale/sandbox/bin/chef-solo)
15
+ expect(provisioner.run_command).to match(/#{ruby} #{chef_solo}/)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ require 'kitchen/provisioner/chef_right_link'
3
+ require 'kitchen/driver/rightscale_vagrant'
4
+
5
+ RSpec.configure do |config|
6
+ config.order = 'random'
7
+ config.expect_with(:rspec) { |c| c.syntax = :expect }
8
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-rightscale
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Cragun
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-kitchen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: kitchen-vagrant
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.14.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.14.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: cane
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'
97
+ - !ruby/object:Gem::Dependency
98
+ name: tailor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: countloc
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-rescue
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: A Test Kitchen Driver and Vagrant Provisioner for Rightscale RightImages
154
+ email:
155
+ - ryan@rightscale.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".cane"
161
+ - ".gitignore"
162
+ - ".rubocop.yml"
163
+ - ".tailor"
164
+ - ".travis.yml"
165
+ - CHANGELOG.md
166
+ - Gemfile
167
+ - LICENSE
168
+ - README.md
169
+ - Rakefile
170
+ - kitchen-rightscale.gemspec
171
+ - lib/kitchen/driver/rightscale_vagrant.rb
172
+ - lib/kitchen/driver/rightscale_vagrant_version.rb
173
+ - lib/kitchen/driver/templates/rsVagrantfile.erb
174
+ - lib/kitchen/provisioner/chef_right_link.rb
175
+ - spec/kitchen/provisioner/chef_right_link_spec.rb
176
+ - spec/spec_helper.rb
177
+ homepage: https://www.github.com/ryancragun/kitchen-rightscale
178
+ licenses:
179
+ - Apache 2.0
180
+ metadata: {}
181
+ post_install_message:
182
+ rdoc_options: []
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ requirements: []
196
+ rubyforge_project:
197
+ rubygems_version: 2.2.2
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: A Test Kitchen Driver and Vagrant Provisioner for Rightscale RightImages
201
+ test_files:
202
+ - spec/kitchen/provisioner/chef_right_link_spec.rb
203
+ - spec/spec_helper.rb