kitchen-itamae 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/kitchen-itamae.gemspec +25 -0
- data/lib/kitchen/provisioner/itamae.rb +100 -0
- data/lib/kitchen-itamae/version.rb +5 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff41b885639874f9de1bf755c4e2417ca3f364f1
|
4
|
+
data.tar.gz: e5db73512b7b6cb172087d1993cce40e32da7078
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8898ce7d956899250ca18df8b34f62745a01e3641a3c63e0a86ed984ee37fcce8875f99149e7ccdc1022790a43e63a0548c34e835a53d531d0337da78ad8cdfb
|
7
|
+
data.tar.gz: bdceff016c4dafd7f35c1e0649e7179f8e8467b1d9662c7b5c9dd39e656624758146c9eb135c9e97922d66b29ef0dad3d98beb9248df98fc9c4a3b790cd0d4d2
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
*.bundle
|
11
|
+
*.so
|
12
|
+
*.o
|
13
|
+
*.a
|
14
|
+
mkmf.log
|
15
|
+
# Created by https://www.gitignore.io
|
16
|
+
|
17
|
+
### Vim ###
|
18
|
+
[._]*.s[a-w][a-z]
|
19
|
+
[._]s[a-w][a-z]
|
20
|
+
*.un~
|
21
|
+
Session.vim
|
22
|
+
.netrwhist
|
23
|
+
*~
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 sawanoboly
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Kitchen::Itamae
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'kitchen-itamae'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install kitchen-itamae
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/kitchen-itamae/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kitchen-itamae/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kitchen-itamae"
|
8
|
+
spec.version = Kitchen::Itamae::VERSION
|
9
|
+
spec.authors = ["sawanoboly"]
|
10
|
+
spec.email = ["sawanoboriyu@higanworks.com"]
|
11
|
+
spec.summary = %q{itamae provisioner for test-kitchen}
|
12
|
+
spec.description = %q{itamae provisioner for test-kitchen}
|
13
|
+
spec.homepage = "https://github.com/OpsRockin/kitchen-itamae"
|
14
|
+
spec.license = "apache2"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "test-kitchen"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'json'
|
2
|
+
require "kitchen-itamae/version"
|
3
|
+
require 'kitchen/provisioner/base'
|
4
|
+
require "kitchen/util"
|
5
|
+
|
6
|
+
module Kitchen
|
7
|
+
module Provisioner
|
8
|
+
class Itamae < Base
|
9
|
+
# TODO: should not parasite chef
|
10
|
+
default_config :parasite_chef_omnibus, true
|
11
|
+
default_config :chef_omnibus_url, "https://www.chef.io/chef/install.sh"
|
12
|
+
default_config :chef_omnibus_root, "/opt/chef"
|
13
|
+
default_config :chef_omnibus_install_options, nil
|
14
|
+
|
15
|
+
default_config :itamae_root, "kitchen"
|
16
|
+
default_config :recipe_list, []
|
17
|
+
default_config :node_json, nil
|
18
|
+
|
19
|
+
# (see Base#create_sandbox)
|
20
|
+
def create_sandbox
|
21
|
+
super
|
22
|
+
# prepare_data
|
23
|
+
# prepare_script
|
24
|
+
FileUtils.cp_r(Dir.glob("kitchen/*"), sandbox_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
def cleanup_sandbox
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
# (see Base#run_command)
|
32
|
+
def run_command
|
33
|
+
runlist = config[:config][:recipe_list].map do |recipe|
|
34
|
+
cmd = ["cd #{config[:root_path]};", "sudo" , 'itamae']
|
35
|
+
cmd << 'local'
|
36
|
+
cmd << "-j #{config[:config][:node_json]}" if config[:config][:node_json]
|
37
|
+
cmd << recipe
|
38
|
+
cmd.join(" ")
|
39
|
+
end
|
40
|
+
Util.wrap_command(runlist.join("\n"))
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
# (see ChefBase#install_command)
|
45
|
+
def install_command
|
46
|
+
return unless config[:parasite_chef_omnibus]
|
47
|
+
lines = [Util.shell_helpers, download_helpers, chef_helpers, chef_install_function, itamae_install_function]
|
48
|
+
Util.wrap_command(lines.join("\n"))
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
# (see ChefBase private)
|
53
|
+
|
54
|
+
def download_helpers
|
55
|
+
IO.read(
|
56
|
+
Gem.find_files_from_load_path('../support/download_helpers.sh').first
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def chef_helpers
|
61
|
+
IO.read(
|
62
|
+
Gem.find_files_from_load_path('../support/chef_helpers.sh').first
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def chef_install_function
|
67
|
+
version = config[:parasite_chef_omnibus].to_s.downcase
|
68
|
+
pretty_version = case version
|
69
|
+
when "true" then "install only if missing"
|
70
|
+
when "latest" then "always install latest version"
|
71
|
+
else version
|
72
|
+
end
|
73
|
+
install_flags = %w[latest true].include?(version) ? "" : "-v #{version}"
|
74
|
+
if config[:chef_omnibus_install_options]
|
75
|
+
install_flags << " " << config[:chef_omnibus_install_options]
|
76
|
+
end
|
77
|
+
<<-INSTALL_CHEF.gsub(/^ {10}/, "")
|
78
|
+
if should_update_chef "#{config[:chef_omnibus_root]}" "#{version}" ; then
|
79
|
+
echo "-----> Installing Chef Omnibus (#{pretty_version})"
|
80
|
+
do_download #{config[:chef_omnibus_url]} /tmp/install.sh
|
81
|
+
#{sudo("sh")} /tmp/install.sh #{install_flags.strip}
|
82
|
+
else
|
83
|
+
echo "-----> Chef Omnibus installation detected (#{pretty_version})"
|
84
|
+
fi
|
85
|
+
INSTALL_CHEF
|
86
|
+
end
|
87
|
+
|
88
|
+
def itamae_install_function
|
89
|
+
<<-INSTALL_ITAMAE
|
90
|
+
cat <<EOL > /tmp/install_itamae.sh
|
91
|
+
[ -f /usr/local/bin/itamae ] && exit
|
92
|
+
/opt/chef/embedded/bin/gem install itamae --no-ri --no-rdoc
|
93
|
+
ln -sf /opt/chef/embedded/bin/itamae /usr/local/bin/
|
94
|
+
EOL
|
95
|
+
#{sudo("sh")} /tmp/install_itamae.sh
|
96
|
+
INSTALL_ITAMAE
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kitchen-itamae
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sawanoboly
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-25 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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '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.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: itamae provisioner for test-kitchen
|
56
|
+
email:
|
57
|
+
- sawanoboriyu@higanworks.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- kitchen-itamae.gemspec
|
68
|
+
- lib/kitchen-itamae/version.rb
|
69
|
+
- lib/kitchen/provisioner/itamae.rb
|
70
|
+
homepage: https://github.com/OpsRockin/kitchen-itamae
|
71
|
+
licenses:
|
72
|
+
- apache2
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.4.5
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: itamae provisioner for test-kitchen
|
94
|
+
test_files: []
|
95
|
+
has_rdoc:
|