kitchen-itamae 0.1.0 → 0.1.1
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/CHANGELOG.md +5 -0
- data/lib/kitchen-itamae/version.rb +1 -1
- data/lib/kitchen/provisioner/itamae.rb +28 -11
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7e3e1aa4c7ba1ee5928e94eede7f4c370adf0e6
|
|
4
|
+
data.tar.gz: 399f22d96967edf51efdd81f4d589481dd202421
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4740ab9c5802e1de67fee3c9019fd58868a5d41ab4483833c386eedf19893bc94e21b0f3ed51b8ad184c9ad91d8e0285ee188af06e99bdd6102fcc4dc24f0935
|
|
7
|
+
data.tar.gz: b4f0bf64645253e3205ebe6ff44eda9751a58d449a4f1947aa4c510c500b5e98dcf3d2789807328930bcd87569981f81695777f6890f442b4f599c675acf6341
|
data/CHANGELOG.md
CHANGED
|
@@ -21,7 +21,10 @@ module Kitchen
|
|
|
21
21
|
default_config :node_json, nil
|
|
22
22
|
default_config :with_ohai, false
|
|
23
23
|
default_config :itamae_option, nil
|
|
24
|
-
default_config :
|
|
24
|
+
default_config :use_bundler do |provisioner|
|
|
25
|
+
config = provisioner.instance_variable_get(:@config)
|
|
26
|
+
File.exists?(File.join(config[:itamae_root], 'Gemfile'))
|
|
27
|
+
end
|
|
25
28
|
|
|
26
29
|
# (see Base#create_sandbox)
|
|
27
30
|
def create_sandbox
|
|
@@ -34,17 +37,31 @@ module Kitchen
|
|
|
34
37
|
cmd = []
|
|
35
38
|
cmd << "#{sudo("rm")} -rf #{config[:root_path]} ; mkdir -p #{config[:root_path]}"
|
|
36
39
|
debug("Cleanup Kitchen Root")
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
Util.wrap_command(cmd.join("\n"))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# (see Base#init_command)
|
|
44
|
+
def prepare_command
|
|
45
|
+
return nil unless config[:use_bundler]
|
|
46
|
+
debug("Prepare Bundler")
|
|
47
|
+
cmd = ["cd #{config[:root_path]};"]
|
|
48
|
+
cmd << "if [ -f Gemfile ] ;then"
|
|
49
|
+
cmd << "#{sudo("/opt/chef/embedded/bin/bundle")} install --binstubs"
|
|
50
|
+
cmd << "fi"
|
|
40
51
|
Util.wrap_command(cmd.join("\n"))
|
|
41
52
|
end
|
|
42
53
|
|
|
43
54
|
# (see Base#run_command)
|
|
44
55
|
def run_command
|
|
45
56
|
debug(JSON.pretty_generate(config))
|
|
46
|
-
|
|
47
|
-
cmd = ["cd #{config[:root_path]};"
|
|
57
|
+
lines = config[:run_list].map do |recipe|
|
|
58
|
+
cmd = ["cd #{config[:root_path]} ;"]
|
|
59
|
+
if config[:use_bundler]
|
|
60
|
+
cmd << sudo(File.join(config[:chef_omnibus_bin_dir], 'ruby'))
|
|
61
|
+
cmd << './bin/itamae'
|
|
62
|
+
else
|
|
63
|
+
cmd << sudo('/opt/chef/bin/itamae')
|
|
64
|
+
end
|
|
48
65
|
cmd << 'local'
|
|
49
66
|
cmd << '--ohai' if config[:with_ohai]
|
|
50
67
|
cmd << config[:itamae_option]
|
|
@@ -52,8 +69,8 @@ module Kitchen
|
|
|
52
69
|
cmd << recipe
|
|
53
70
|
cmd.join(" ")
|
|
54
71
|
end
|
|
55
|
-
debug(
|
|
56
|
-
Util.wrap_command(
|
|
72
|
+
debug(lines.join("\n"))
|
|
73
|
+
Util.wrap_command(lines.join("\n"))
|
|
57
74
|
end
|
|
58
75
|
|
|
59
76
|
|
|
@@ -104,10 +121,10 @@ module Kitchen
|
|
|
104
121
|
def itamae_install_function
|
|
105
122
|
<<-INSTALL_ITAMAE
|
|
106
123
|
cat <<EOL > /tmp/install_itamae.sh
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
#{sudo('chef-apply')} -e "chef_gem %Q{itamae} do action :upgrade end"
|
|
125
|
+
ln -sf /opt/chef/embedded/bin/itamae /opt/chef/bin/itamae
|
|
109
126
|
EOL
|
|
110
|
-
|
|
127
|
+
#{sudo("sh")} /tmp/install_itamae.sh
|
|
111
128
|
INSTALL_ITAMAE
|
|
112
129
|
end
|
|
113
130
|
end
|