kitchen-goiardi 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: 35e6b93635e7319b82f1ab7498c2f0d0193a3cc9
4
+ data.tar.gz: 2db7151f65fb926b362a61643c026f433f0cfc8b
5
+ SHA512:
6
+ metadata.gz: 09ec8fb37962642e9b7eb5891fcda16a84aebbbcc90633af6e413d0d578883fa83f9d5a48a663fbe4e09c973e2a4ff94918462d0250d7ec579413a634dec18d9
7
+ data.tar.gz: 92f33fb2d1cb2e9d6391d0dfda41e188d087866251bc25f7dfc38964e2a4303adb14a93d577db4ff2fb5a944d4095947c5e2efd32300730db36c81a4b585c29b
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/.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:: Brad Beam (<brad.beam@cerner.com>)
2
+
3
+ Copyright (C) 2014, Brad Beam
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::Goiardi
2
+
3
+ A Test Kitchen Driver for Goiardi.
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 [Brad Beam][author] (<brad.beam@cerner.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-goiardi/issues
61
+ [license]: https://github.com/enter-github-user/kitchen-goiardi/blob/master/LICENSE
62
+ [repo]: https://github.com/enter-github-user/kitchen-goiardi
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 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/provisioner/goiardi_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-goiardi'
8
+ spec.version = Kitchen::Provisioner::GOIARDI_VERSION
9
+ spec.authors = ['Brad Beam']
10
+ spec.email = ['brad.beam@b-rad.info']
11
+ spec.description = %q{A Test Kitchen Provisioner for Goiardi}
12
+ spec.summary = spec.description
13
+ spec.homepage = ''
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ #spec.require_paths = ['lib', "support"]
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'test-kitchen', '~> 1.0'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+
27
+ # spec.add_development_dependency 'cane'
28
+ # spec.add_development_dependency 'tailor'
29
+ # spec.add_development_dependency 'countloc'
30
+ end
@@ -0,0 +1,100 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Brad Beam (<brad.beam@b-rad.info>)
4
+ #
5
+ # Copyright (C) 2014, Brad Beam
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/provisioner/chef_base'
21
+
22
+ module Kitchen
23
+
24
+ module Provisioner
25
+
26
+ # Goiardi driver for Kitchen.
27
+ #
28
+ # @author Brad Beam <brad.beam@b-rad.info>
29
+ #class Goiardi < Kitchen::Driver::SSHBase
30
+ class Goiardi < ChefBase
31
+
32
+ default_config :client_rb, {}
33
+ default_config :goiardi_version, 'v0.5.1'
34
+ default_config :goiardi_port, '4545'
35
+ default_config :json_attributes, true
36
+ default_config :goiardi_location, "https://github.com/bradbeam/goiardi/releases/download"
37
+
38
+ def create_sandbox
39
+ super
40
+ prepare_validation_pem
41
+ prepare_client_rb
42
+ end
43
+
44
+ def prepare_command
45
+ data = default_config_rb
46
+ <<-PREPARE
47
+ sh -c '
48
+ #{Util.shell_helpers}
49
+
50
+ if [ ! -f #{config[:root_path]}/goiardi ]; then
51
+ echo -n "Downloading goiardi..."
52
+ do_download #{config[:goiardi_location]}/#{config[:goiardi_version]}/goiardi #{config[:root_path]}/goiardi
53
+ chmod 755 #{config[:root_path]}/goiardi
54
+ echo "done!"
55
+ fi
56
+ if [ -z "$(ps --no-header -C goiardi )" ]; then
57
+ echo -n "Starting goiardi server... "
58
+ sudo nohup #{config[:root_path]}/goiardi -V -H localhost -P #{config[:goiardi_port]} --conf-root=#{config[:root_path]} > #{config[:root_path]}/goiardi.log 2>&1 &
59
+ echo "done!"
60
+ fi
61
+ echo -n "Uploading cookbooks to goiardi..."
62
+ sudo knife cookbook upload -o #{config[:root_path]}/cookbooks -a -c #{config[:root_path]}/client.rb >> #{config[:root_path]}/goiardi.log 2>&1
63
+ echo "done!"
64
+ '
65
+ PREPARE
66
+ end
67
+
68
+ def run_command
69
+ args = [
70
+ "--config #{config[:root_path]}/client.rb",
71
+ "--log_level #{config[:log_level]}"
72
+ ]
73
+ if config[:json_attributes]
74
+ args << "--json-attributes #{config[:root_path]}/dna.json"
75
+ end
76
+
77
+ ["#{sudo('chef-client')} "].concat(args).join(" ")
78
+ end
79
+
80
+ private
81
+
82
+ def prepare_validation_pem
83
+ source = File.join(File.dirname(__FILE__),
84
+ %w{.. .. .. support dummy-validation.pem})
85
+ FileUtils.cp(source, File.join(sandbox_path, "validation.pem"))
86
+ end
87
+
88
+ def prepare_client_rb
89
+ data = default_config_rb.merge(config[:client_rb])
90
+ data[:chef_server_url] = "http://127.0.0.1:#{config[:goiardi_port]}"
91
+ data[:verify_peer] = :verify_peer
92
+ data[:client_key] = File.join(config[:root_path], "validation.pem")
93
+ File.open(File.join(sandbox_path, "client.rb"), "wb") do |file|
94
+ file.write(format_config_file(data))
95
+ end
96
+ end
97
+
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Brad Beam (<brad.beam@b-rad.info>)
4
+ #
5
+ # Copyright (C) 2014, Brad Beam
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
+
21
+ module Provisioner
22
+
23
+ # Version string for Goiardi Kitchen provisioner
24
+ GOIARDI_VERSION = "0.1.0"
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpAIBAAKCAQEA0sOY9tHvVtLZ6xmVmH8d8LrRrNcWOXbrvvCrai+T3GtRvRSL
3
+ hksLrpOpD0L9EHM6NdThNF/eGA9Oq+UKAe6yXR0hwsKuxKXqQ8SEmlhZZ9GiuggD
4
+ B/zYD3ItB6SGpdkRe7kQqTChQyrIXqbRkJqxoTXLyeJDF0sCyTdp3L8IZCUWodM8
5
+ oV9TlQBJHYtG1gLUwIi8kcMVEoCn2Q8ltCj0/ftnwhTtwO52RkWA0uYOLGVayHsL
6
+ SCFfx+ACWPU/oWCwW5/KBqb3veTv0aEg/nh0QsFzRLoTx6SRFI5dT2Nf8iiJe4WC
7
+ UG8WKEB2G8QPnxsxfOPYDBdTJ4CXEi2e+z41VQIDAQABAoIBAALhqbW2KQ+G0nPk
8
+ ZacwFbi01SkHx8YBWjfCEpXhEKRy0ytCnKW5YO+CFU2gHNWcva7+uhV9OgwaKXkw
9
+ KHLeUJH1VADVqI4Htqw2g5mYm6BPvWnNsjzpuAp+BR+VoEGkNhj67r9hatMAQr0I
10
+ itTvSH5rvd2EumYXIHKfz1K1SegUk1u1EL1RcMzRmZe4gDb6eNBs9Sg4im4ybTG6
11
+ pPIytA8vBQVWhjuAR2Tm+wZHiy0Az6Vu7c2mS07FSX6FO4E8SxWf8idaK9ijMGSq
12
+ FvIS04mrY6XCPUPUC4qm1qNnhDPpOr7CpI2OO98SqGanStS5NFlSFXeXPpM280/u
13
+ fZUA0AECgYEA+x7QUnffDrt7LK2cX6wbvn4mRnFxet7bJjrfWIHf+Rm0URikaNma
14
+ h0/wNKpKBwIH+eHK/LslgzcplrqPytGGHLOG97Gyo5tGAzyLHUWBmsNkRksY2sPL
15
+ uHq6pYWJNkqhnWGnIbmqCr0EWih82x/y4qxbJYpYqXMrit0wVf7yAgkCgYEA1twI
16
+ gFaXqesetTPoEHSQSgC8S4D5/NkdriUXCYb06REcvo9IpFMuiOkVUYNN5d3MDNTP
17
+ IdBicfmvfNELvBtXDomEUD8ls1UuoTIXRNGZ0VsZXu7OErXCK0JKNNyqRmOwcvYL
18
+ JRqLfnlei5Ndo1lu286yL74c5rdTLs/nI2p4e+0CgYB079ZmcLeILrmfBoFI8+Y/
19
+ gJLmPrFvXBOE6+lRV7kqUFPtZ6I3yQzyccETZTDvrnx0WjaiFavUPH27WMjY01S2
20
+ TMtO0Iq1MPsbSrglO1as8MvjB9ldFcvp7gy4Q0Sv6XT0yqJ/S+vo8Df0m+H4UBpU
21
+ f5o6EwBSd/UQxwtZIE0lsQKBgQCswfjX8Eg8KL/lJNpIOOE3j4XXE9ptksmJl2sB
22
+ jxDnQYoiMqVO808saHVquC/vTrpd6tKtNpehWwjeTFuqITWLi8jmmQ+gNTKsC9Gn
23
+ 1Pxf2Gb67PqnEpwQGln+TRtgQ5HBrdHiQIi+5am+gnw89pDrjjO5rZwhanAo6KPJ
24
+ 1zcPNQKBgQDxFu8v4frDmRNCVaZS4f1B6wTrcMrnibIDlnzrK9GG6Hz1U7dDv8s8
25
+ Nf4UmeMzDXjlPWZVOvS5+9HKJPdPj7/onv8B2m18+lcgTTDJBkza7R1mjL1Cje/Z
26
+ KcVGsryKN6cjE7yCDasnA7R2rVBV/7NWeJV77bmzT5O//rW4yIfUIg==
27
+ -----END RSA PRIVATE KEY-----
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-goiardi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brad Beam
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-23 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.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A Test Kitchen Provisioner for Goiardi
56
+ email:
57
+ - brad.beam@b-rad.info
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".cane"
63
+ - ".gitignore"
64
+ - ".tailor"
65
+ - ".travis.yml"
66
+ - CHANGELOG.md
67
+ - Gemfile
68
+ - LICENSE
69
+ - README.md
70
+ - Rakefile
71
+ - kitchen-goiardi.gemspec
72
+ - lib/kitchen/provisioner/goiardi.rb
73
+ - lib/kitchen/provisioner/goiardi_version.rb
74
+ - support/dummy-validation.pem
75
+ homepage: ''
76
+ licenses:
77
+ - Apache 2.0
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.0.3
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: A Test Kitchen Provisioner for Goiardi
99
+ test_files: []
100
+ has_rdoc: