test-kitchen-rsync 3.0.0.pre.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.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +21 -0
  3. data/LICENSE +15 -0
  4. data/Rakefile +53 -0
  5. data/bin/zl-kitchen +11 -0
  6. data/lib/kitchen/base64_stream.rb +48 -0
  7. data/lib/kitchen/chef_utils_wiring.rb +40 -0
  8. data/lib/kitchen/cli.rb +413 -0
  9. data/lib/kitchen/collection.rb +52 -0
  10. data/lib/kitchen/color.rb +63 -0
  11. data/lib/kitchen/command/action.rb +41 -0
  12. data/lib/kitchen/command/console.rb +54 -0
  13. data/lib/kitchen/command/diagnose.rb +84 -0
  14. data/lib/kitchen/command/doctor.rb +39 -0
  15. data/lib/kitchen/command/exec.rb +37 -0
  16. data/lib/kitchen/command/list.rb +148 -0
  17. data/lib/kitchen/command/login.rb +39 -0
  18. data/lib/kitchen/command/package.rb +32 -0
  19. data/lib/kitchen/command/sink.rb +50 -0
  20. data/lib/kitchen/command/test.rb +47 -0
  21. data/lib/kitchen/command.rb +207 -0
  22. data/lib/kitchen/config.rb +344 -0
  23. data/lib/kitchen/configurable.rb +616 -0
  24. data/lib/kitchen/data_munger.rb +1024 -0
  25. data/lib/kitchen/diagnostic.rb +138 -0
  26. data/lib/kitchen/driver/base.rb +133 -0
  27. data/lib/kitchen/driver/dummy.rb +105 -0
  28. data/lib/kitchen/driver/exec.rb +70 -0
  29. data/lib/kitchen/driver/proxy.rb +70 -0
  30. data/lib/kitchen/driver/ssh_base.rb +351 -0
  31. data/lib/kitchen/driver.rb +40 -0
  32. data/lib/kitchen/errors.rb +243 -0
  33. data/lib/kitchen/generator/init.rb +254 -0
  34. data/lib/kitchen/instance.rb +726 -0
  35. data/lib/kitchen/lazy_hash.rb +148 -0
  36. data/lib/kitchen/lifecycle_hook/base.rb +78 -0
  37. data/lib/kitchen/lifecycle_hook/local.rb +53 -0
  38. data/lib/kitchen/lifecycle_hook/remote.rb +39 -0
  39. data/lib/kitchen/lifecycle_hooks.rb +92 -0
  40. data/lib/kitchen/loader/yaml.rb +377 -0
  41. data/lib/kitchen/logger.rb +422 -0
  42. data/lib/kitchen/logging.rb +52 -0
  43. data/lib/kitchen/login_command.rb +49 -0
  44. data/lib/kitchen/metadata_chopper.rb +49 -0
  45. data/lib/kitchen/platform.rb +64 -0
  46. data/lib/kitchen/plugin.rb +76 -0
  47. data/lib/kitchen/plugin_base.rb +60 -0
  48. data/lib/kitchen/provisioner/base.rb +269 -0
  49. data/lib/kitchen/provisioner/chef/berkshelf.rb +116 -0
  50. data/lib/kitchen/provisioner/chef/common_sandbox.rb +350 -0
  51. data/lib/kitchen/provisioner/chef/policyfile.rb +163 -0
  52. data/lib/kitchen/provisioner/chef_apply.rb +121 -0
  53. data/lib/kitchen/provisioner/chef_base.rb +705 -0
  54. data/lib/kitchen/provisioner/chef_infra.rb +167 -0
  55. data/lib/kitchen/provisioner/chef_solo.rb +82 -0
  56. data/lib/kitchen/provisioner/chef_zero.rb +12 -0
  57. data/lib/kitchen/provisioner/dummy.rb +75 -0
  58. data/lib/kitchen/provisioner/shell.rb +157 -0
  59. data/lib/kitchen/provisioner.rb +42 -0
  60. data/lib/kitchen/rake_tasks.rb +80 -0
  61. data/lib/kitchen/shell_out.rb +90 -0
  62. data/lib/kitchen/ssh.rb +289 -0
  63. data/lib/kitchen/state_file.rb +112 -0
  64. data/lib/kitchen/suite.rb +48 -0
  65. data/lib/kitchen/thor_tasks.rb +63 -0
  66. data/lib/kitchen/transport/base.rb +236 -0
  67. data/lib/kitchen/transport/dummy.rb +78 -0
  68. data/lib/kitchen/transport/exec.rb +145 -0
  69. data/lib/kitchen/transport/ssh.rb +579 -0
  70. data/lib/kitchen/transport/winrm.rb +546 -0
  71. data/lib/kitchen/transport.rb +40 -0
  72. data/lib/kitchen/util.rb +229 -0
  73. data/lib/kitchen/verifier/base.rb +243 -0
  74. data/lib/kitchen/verifier/busser.rb +275 -0
  75. data/lib/kitchen/verifier/dummy.rb +75 -0
  76. data/lib/kitchen/verifier/shell.rb +99 -0
  77. data/lib/kitchen/verifier.rb +39 -0
  78. data/lib/kitchen/version.rb +20 -0
  79. data/lib/kitchen/which.rb +26 -0
  80. data/lib/kitchen.rb +152 -0
  81. data/lib/vendor/hash_recursive_merge.rb +79 -0
  82. data/support/busser_install_command.ps1 +14 -0
  83. data/support/busser_install_command.sh +21 -0
  84. data/support/chef-client-fail-if-update-handler.rb +15 -0
  85. data/support/chef_base_init_command.ps1 +18 -0
  86. data/support/chef_base_init_command.sh +1 -0
  87. data/support/chef_base_install_command.ps1 +85 -0
  88. data/support/chef_base_install_command.sh +229 -0
  89. data/support/download_helpers.sh +109 -0
  90. data/support/dummy-validation.pem +27 -0
  91. data/templates/driver/CHANGELOG.md.erb +3 -0
  92. data/templates/driver/Gemfile.erb +3 -0
  93. data/templates/driver/README.md.erb +64 -0
  94. data/templates/driver/Rakefile.erb +21 -0
  95. data/templates/driver/driver.rb.erb +23 -0
  96. data/templates/driver/gemspec.erb +29 -0
  97. data/templates/driver/gitignore.erb +17 -0
  98. data/templates/driver/license_apachev2.erb +15 -0
  99. data/templates/driver/license_lgplv3.erb +16 -0
  100. data/templates/driver/license_mit.erb +22 -0
  101. data/templates/driver/license_reserved.erb +5 -0
  102. data/templates/driver/tailor.erb +4 -0
  103. data/templates/driver/travis.yml.erb +11 -0
  104. data/templates/driver/version.rb.erb +12 -0
  105. data/templates/init/chefignore.erb +2 -0
  106. data/templates/init/kitchen.yml.erb +18 -0
  107. data/test-kitchen.gemspec +52 -0
  108. metadata +528 -0
@@ -0,0 +1,79 @@
1
+ #
2
+ # = Hash Recursive Merge
3
+ #
4
+ # Merges a Ruby Hash recursively, Also known as deep merge.
5
+ # Recursive version of Hash#merge and Hash#merge!.
6
+ #
7
+ # Category:: Ruby
8
+ # Package:: Hash
9
+ # Author:: Simone Carletti <weppos@weppos.net>
10
+ # Copyright:: 2007-2008 The Authors
11
+ # License:: MIT License
12
+ # Link:: http://www.simonecarletti.com/
13
+ # Source:: http://gist.github.com/gists/6391/
14
+ #
15
+ module HashRecursiveMerge
16
+ #
17
+ # Recursive version of Hash#merge!
18
+ #
19
+ # Adds the contents of +other_hash+ to +hsh+,
20
+ # merging entries in +hsh+ with duplicate keys with those from +other_hash+.
21
+ #
22
+ # Compared with Hash#merge!, this method supports nested hashes.
23
+ # When both +hsh+ and +other_hash+ contains an entry with the same key,
24
+ # it merges and returns the values from both arrays.
25
+ #
26
+ # @example
27
+ #
28
+ # h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
29
+ # h2 = {"b" => 254, "c" => {"c1" => 16, "c3" => 94}}
30
+ # h1.rmerge!(h2) #=> {"a" => 100, "b" => 254, "c" => {"c1" => 16, "c2" => 14, "c3" => 94}}
31
+ #
32
+ # Simply using Hash#merge! would return
33
+ #
34
+ # @example
35
+ #
36
+ # h1.merge!(h2) #=> {"a" => 100, "b" = >254, "c" => {"c1" => 16, "c3" => 94}}
37
+ #
38
+ def rmerge!(other_hash)
39
+ merge!(other_hash) do |_key, oldval, newval|
40
+ oldval.class == self.class ? oldval.rmerge!(newval) : newval
41
+ end
42
+ end
43
+
44
+ #
45
+ # Recursive version of Hash#merge
46
+ #
47
+ # Compared with Hash#merge!, this method supports nested hashes.
48
+ # When both +hsh+ and +other_hash+ contains an entry with the same key,
49
+ # it merges and returns the values from both arrays.
50
+ #
51
+ # Compared with Hash#merge, this method provides a different approch
52
+ # for merging nasted hashes.
53
+ # If the value of a given key is an Hash and both +other_hash+ abd +hsh
54
+ # includes the same key, the value is merged instead replaced with
55
+ # +other_hash+ value.
56
+ #
57
+ # @example
58
+ #
59
+ # h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
60
+ # h2 = {"b" => 254, "c" => {"c1" => 16, "c3" => 94}}
61
+ # h1.rmerge(h2) #=> {"a" => 100, "b" => 254, "c" => {"c1" => 16, "c2" => 14, "c3" => 94}}
62
+ #
63
+ # Simply using Hash#merge would return
64
+ #
65
+ # @example
66
+ #
67
+ # h1.merge(h2) #=> {"a" => 100, "b" = >254, "c" => {"c1" => 16, "c3" => 94}}
68
+ #
69
+ def rmerge(other_hash)
70
+ r = {}
71
+ merge(other_hash) do |key, oldval, newval|
72
+ r[key] = oldval.class == self.class ? oldval.rmerge(newval) : newval
73
+ end
74
+ end
75
+ end
76
+
77
+ class Hash
78
+ include HashRecursiveMerge
79
+ end
@@ -0,0 +1,14 @@
1
+ if ((& "$ruby" "$gem" list busser -i) -ne "true") {
2
+ Write-Host "-----> Installing Busser ($version)`n"
3
+ & "$ruby" "$gem" install $gem_install_args.Split() 2>&1
4
+ } else {
5
+ Write-Host "-----> Busser installation detected ($version)`n"
6
+ }
7
+
8
+ if (-Not (Test-Path "$busser")) {
9
+ $gem_bindir = & "$ruby" -rrubygems -e "puts Gem.bindir.dup.gsub('/', '\\')"
10
+ & "$ruby" "$gem_bindir\busser" setup --type bat 2>&1
11
+ }
12
+
13
+ Write-Host " Installing Busser plugins: $plugins`n"
14
+ & "$busser" plugin install $plugins.Split() 2>&1
@@ -0,0 +1,21 @@
1
+ $gem list --no-versions | grep "^busser" 2>&1 >/dev/null
2
+ if test $? -ne 0; then
3
+ echo "-----> Installing Busser ($version)"
4
+ $gem install $gem_install_args
5
+ else
6
+ echo "-----> Busser installation detected ($version)"
7
+ fi
8
+
9
+ if test ! -f "$BUSSER_ROOT/bin/busser"; then
10
+ $busser setup
11
+ fi
12
+
13
+ for plugin in $plugins; do
14
+ $gem list --no-versions | grep "^$plugin$" 2>&1 >/dev/null
15
+ if test $? -ne 0; then
16
+ echo "-----> Installing Busser plugin: $plugin"
17
+ $busser plugin install $plugin
18
+ else
19
+ echo "-----> Busser plugin detected: $plugin"
20
+ fi
21
+ done
@@ -0,0 +1,15 @@
1
+ # Handler to kill the run if any resource is updated
2
+ class UpdatedResources < ::Chef::Handler
3
+ def report
4
+ if updated_resources.size > 0
5
+ puts "First chef run should have reached a converged state."
6
+ puts "Resources updated in a second chef-client run:"
7
+ updated_resources.each do |r|
8
+ puts "- #{r}"
9
+ end
10
+ # exit 203 # chef handler catch Exception instead of StandardException
11
+ Process.kill("KILL", Process.pid)
12
+ end
13
+ end
14
+ end
15
+ report_handlers << UpdatedResources.new
@@ -0,0 +1,18 @@
1
+ Function Delete-AllDirs($dirs) {
2
+ $dirs | ForEach-Object {
3
+ if (Test-Path ($path = Unresolve-Path $_)) { Remove-Item $path -Recurse -Force }
4
+ }
5
+ }
6
+
7
+ Function Unresolve-Path($p) {
8
+ if ($p -eq $null) { return $null }
9
+ else { return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($p) }
10
+ }
11
+
12
+ Function Make-RootPath($p) {
13
+ $p = Unresolve-Path $p
14
+ if (-Not (Test-Path $p)) { New-Item $p -ItemType directory | Out-Null }
15
+ }
16
+
17
+ Delete-AllDirs $dirs
18
+ Make-RootPath $root_path
@@ -0,0 +1 @@
1
+ mkdir -p $root_path
@@ -0,0 +1,85 @@
1
+ $ErrorActionPreference = "stop"
2
+
3
+ Function Check-UpdateChef($root, $version) {
4
+ if (-Not (Test-Path $root)) { return $true }
5
+ elseif ("$version" -eq "true") { return $false }
6
+ elseif ("$version" -eq "latest") { return $true }
7
+ Try { $chef_version = (Get-Content $root\version-manifest.txt | select-object -first 1) }
8
+ Catch {
9
+ Try { $chef_version = (& $root\bin\chef-solo.bat -v) }
10
+ Catch { $chef_version = " " }
11
+ }
12
+
13
+ if ($chef_version.split(" ", 2)[1].StartsWith($version)) { return $false }
14
+ else { return $true }
15
+ }
16
+
17
+ Function Get-ChefMetadata($url) {
18
+ Try { $response = ($c = Make-WebClient).DownloadString($url) }
19
+ Finally { if ($c -ne $null) { $c.Dispose() } }
20
+
21
+ $md = ConvertFrom-StringData $response.Replace("`t", "=")
22
+ return @($md.url, $md.md5)
23
+ }
24
+
25
+ Function Get-MD5Sum($src) {
26
+ Try {
27
+ $c = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
28
+ $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
29
+ return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
30
+ } Finally { if (($c -ne $null) -and ($c.GetType().GetMethod("Dispose") -ne $null)) { $c.Dispose() }; if ($in -ne $null) { $in.Dispose() } }
31
+ }
32
+
33
+ Function Download-Chef($md_url, $dst) {
34
+ $url, $md5 = Get-ChefMetadata $md_url
35
+
36
+ Try {
37
+ Log "Downloading package from $url"
38
+ ($c = Make-WebClient).DownloadFile($url, $dst)
39
+ Log "Download complete."
40
+ } Finally { if ($c -ne $null) { $c.Dispose() } }
41
+
42
+ if (($dmd5 = Get-MD5Sum $dst) -eq $md5) { Log "Successfully verified $dst" }
43
+ else { throw "MD5 for $dst $dmd5 does not match $md5" }
44
+ }
45
+
46
+ Function Install-Chef($msi) {
47
+ Log "Installing Chef Infra Client package $msi"
48
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
49
+
50
+ if ($p.ExitCode -ne 0) { throw "msiexec was not successful. Received exit code $($p.ExitCode)" }
51
+
52
+ Remove-Item $msi -Force
53
+ Log "Installation complete"
54
+ }
55
+
56
+ Function Log($m) { Write-Host " $m`n" }
57
+
58
+ Function Make-WebClient {
59
+ $proxy = New-Object -TypeName System.Net.WebProxy
60
+ $proxy.Address = $env:http_proxy
61
+ $client = New-Object -TypeName System.Net.WebClient
62
+ $client.Proxy = $proxy
63
+ return $client
64
+ }
65
+
66
+ Function Unresolve-Path($p) {
67
+ if ($p -eq $null) { return $null }
68
+ else { return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($p) }
69
+ }
70
+
71
+ Try {
72
+ $chef_omnibus_root = Unresolve-Path $chef_omnibus_root
73
+ $msi = Unresolve-Path $msi
74
+
75
+ if (Check-UpdateChef $chef_omnibus_root $version) {
76
+ Write-Host "-----> Installing Chef Infra Client package ($pretty_version)`n"
77
+ Download-Chef "$chef_metadata_url" $msi
78
+ Install-Chef $msi
79
+ } else {
80
+ Write-Host "-----> Chef Infra Client package installation detected ($pretty_version)`n"
81
+ }
82
+ Catch {
83
+ Write-Error ($_ | ft -Property * | out-string) -ErrorAction Continue
84
+ exit 1
85
+ }
@@ -0,0 +1,229 @@
1
+ tmp_stderr="/tmp/stderr";
2
+
3
+ # capture_tmp_stderr SOURCE
4
+ capture_tmp_stderr() {
5
+ # spool up $tmp_stderr from all the commands we called
6
+ if test -f "$tmp_stderr"; then
7
+ output="`cat $tmp_stderr`";
8
+ stderr_results="${stderr_results}\nSTDERR from $1:\n\n${output}\n";
9
+ rm $tmp_stderr;
10
+ fi
11
+ }
12
+
13
+ # do_curl URL FILENAME
14
+ do_curl() {
15
+ echo "Trying curl...";
16
+ curl -sL -D "$tmp_stderr" "$1" > "$2";
17
+ ec=$?;
18
+ # check for 404
19
+ grep "404 Not Found" "$tmp_stderr" 2>&1 >/dev/null;
20
+ if test $? -eq 0; then
21
+ http_404_error "$1";
22
+ fi
23
+
24
+ # check for bad return status or empty output
25
+ if test $ec -ne 0 || test ! -s "$2"; then
26
+ capture_tmp_stderr "curl";
27
+ return 1;
28
+ else
29
+ echo "Download complete.";
30
+ return 0;
31
+ fi
32
+ }
33
+
34
+ # do_download URL FILENAME
35
+ do_download() {
36
+ echo "Downloading ${1} to file ${2}";
37
+
38
+ exists wget;
39
+ if test $? -eq 0; then
40
+ do_wget "$1" "$2" && return 0;
41
+ fi
42
+
43
+ exists curl;
44
+ if test $? -eq 0; then
45
+ do_curl "$1" "$2" && return 0;
46
+ fi
47
+
48
+ exists fetch;
49
+ if test $? -eq 0; then
50
+ do_fetch "$1" "$2" && return 0;
51
+ fi
52
+
53
+ exists python;
54
+ if test $? -eq 0; then
55
+ do_python "$1" "$2" && return 0;
56
+ fi
57
+
58
+ exists perl;
59
+ if test $? -eq 0; then
60
+ do_perl "$1" "$2" && return 0;
61
+ fi
62
+
63
+ unable_to_download "$1" "$2";
64
+ }
65
+
66
+ # do_fetch URL FILENAME
67
+ do_fetch() {
68
+ echo "Trying fetch...";
69
+ fetch -o "$2" "$1" 2>"$tmp_stderr";
70
+ ec=$?;
71
+ # check for 404
72
+ grep "Not Found" "$tmp_stderr" 2>&1 >/dev/null;
73
+ if test $? -eq 0; then
74
+ http_404_error "$1";
75
+ fi
76
+
77
+ # check for bad return status or empty output
78
+ if test $ec -ne 0 || test ! -s "$2"; then
79
+ capture_tmp_stderr "fetch";
80
+ return 1;
81
+ else
82
+ echo "Download complete.";
83
+ return 0;
84
+ fi
85
+ }
86
+
87
+ # do_perl URL FILENAME
88
+ do_perl() {
89
+ echo "Trying perl...";
90
+ perl -e "use LWP::Simple; getprint(\$ARGV[0]);" "$1" > "$2" 2>"$tmp_stderr";
91
+ ec=$?;
92
+ # check for 404
93
+ grep "404 Not Found" "$tmp_stderr" 2>&1 >/dev/null;
94
+ if test $? -eq 0; then
95
+ http_404_error "$1";
96
+ fi
97
+
98
+ # check for bad return status or empty output
99
+ if test $ec -ne 0 || test ! -s "$2"; then
100
+ capture_tmp_stderr "perl";
101
+ return 1;
102
+ else
103
+ echo "Download complete.";
104
+ return 0;
105
+ fi
106
+ }
107
+
108
+ # do_python URL FILENAME
109
+ do_python() {
110
+ echo "Trying python...";
111
+ python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2" 2>"$tmp_stderr";
112
+ ec=$?;
113
+ # check for 404
114
+ grep "HTTP Error 404" "$tmp_stderr" 2>&1 >/dev/null;
115
+ if test $? -eq 0; then
116
+ http_404_error "$1";
117
+ fi
118
+
119
+ # check for bad return status or empty output
120
+ if test $ec -ne 0 || test ! -s "$2"; then
121
+ capture_tmp_stderr "python";
122
+ return 1;
123
+ else
124
+ echo "Download complete.";
125
+ return 0;
126
+ fi
127
+ }
128
+
129
+ # do_wget URL FILENAME
130
+ do_wget() {
131
+ echo "Trying wget...";
132
+ wget -O "$2" "$1" 2>"$tmp_stderr";
133
+ ec=$?;
134
+ # check for 404
135
+ grep "ERROR 404" "$tmp_stderr" 2>&1 >/dev/null;
136
+ if test $? -eq 0; then
137
+ http_404_error "$1";
138
+ fi
139
+
140
+ # check for bad return status or empty output
141
+ if test $ec -ne 0 || test ! -s "$2"; then
142
+ capture_tmp_stderr "wget";
143
+ return 1;
144
+ else
145
+ echo "Download complete.";
146
+ return 0;
147
+ fi
148
+ }
149
+
150
+ # exists COMMAND
151
+ exists() {
152
+ if command -v "$1" >/dev/null 2>&1; then
153
+ return 0;
154
+ else
155
+ return 1;
156
+ fi
157
+ }
158
+
159
+ # http_404_error URL
160
+ http_404_error() {
161
+ echo ">>>>>> Downloading ${1} resulted in an HTTP/404, aborting";
162
+ exit 40;
163
+ }
164
+
165
+ # should_update_chef ROOT VERSION
166
+ should_update_chef() {
167
+ if test ! -d "$1"; then
168
+ return 0;
169
+ elif test "$2" = "true"; then
170
+ return 1;
171
+ elif test "$2" = "latest"; then
172
+ return 0;
173
+ fi
174
+
175
+ if test -f "${1}/version-manifest.txt"; then
176
+ chef_version="`head -n 1 ${1}/version-manifest.txt | cut -d \" \" -f 2`";
177
+ else
178
+ chef_version="`${1}/bin/chef-solo -v | cut -d \" \" -f 2`";
179
+ fi
180
+
181
+ echo "$chef_version" | grep "^${2}" 2>&1 >/dev/null;
182
+ if test $? -eq 0; then
183
+ return 1;
184
+ else
185
+ echo "${2}" | grep "^$chef_version" 2>&1 >/dev/null;
186
+ if test $? -eq 0; then
187
+ return 1;
188
+ else
189
+ return 0;
190
+ fi
191
+ fi
192
+ }
193
+
194
+ # unable_to_download URL FILE
195
+ unable_to_download() {
196
+ echo "Unable to download $1 to $2, aborting";
197
+
198
+ if test "x${stderr_results}" != "x"; then
199
+ echo "\nDEBUG OUTPUT FOLLOWS:\n${stderr_results}";
200
+ fi
201
+
202
+ exit 10;
203
+ }
204
+
205
+ # main
206
+ main() {
207
+ should_update_chef "$chef_omnibus_root" "$version"
208
+ if test $? -eq 0; then
209
+ echo "-----> Installing Chef Infra Client package (${pretty_version})";
210
+
211
+ # solaris 10 lacks recent enough credentials, so http url is used
212
+ platform="`/usr/bin/uname -s 2>/dev/null`";
213
+ platform_version="`/usr/bin/uname -r 2>/dev/null`";
214
+ if test "x${platform}" = "xSunOS" && test "x${platform_version}" = "x5.10"; then
215
+ chef_omnibus_url=`echo "$chef_omnibus_url" | sed -e "s/https/http/"`;
216
+ fi
217
+
218
+ do_download "$chef_omnibus_url" /tmp/install.sh;
219
+ $sudo_sh /tmp/install.sh $install_flags;
220
+ else
221
+ echo "-----> Chef Infra Client package installation detected (${pretty_version})";
222
+ fi
223
+ }
224
+
225
+ # augment path in an attempt to find a download program
226
+ PATH="${PATH}:/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/sfw/bin";
227
+ export PATH;
228
+
229
+ main
@@ -0,0 +1,109 @@
1
+ # Check whether a command exists - returns 0 if it does, 1 if it does not
2
+ exists() {
3
+ if command -v $1 >/dev/null 2>&1
4
+ then
5
+ return 0
6
+ else
7
+ return 1
8
+ fi
9
+ }
10
+
11
+ # do_wget URL FILENAME
12
+ do_wget() {
13
+ echo "trying wget..."
14
+ wget -O "$2" "$1" 2>/tmp/stderr
15
+ # check for bad return status
16
+ test $? -ne 0 && return 1
17
+ # check for 404 or empty file
18
+ grep "ERROR 404" /tmp/stderr 2>&1 >/dev/null
19
+ if test $? -eq 0 || test ! -s "$2"; then
20
+ return 1
21
+ fi
22
+ return 0
23
+ }
24
+
25
+ # do_curl URL FILENAME
26
+ do_curl() {
27
+ echo "trying curl..."
28
+ curl -L "$1" > "$2"
29
+ # check for bad return status
30
+ [ $? -ne 0 ] && return 1
31
+ # check for bad output or empty file
32
+ grep "The specified key does not exist." "$2" 2>&1 >/dev/null
33
+ if test $? -eq 0 || test ! -s "$2"; then
34
+ return 1
35
+ fi
36
+ return 0
37
+ }
38
+
39
+ # do_fetch URL FILENAME
40
+ do_fetch() {
41
+ echo "trying fetch..."
42
+ fetch -o "$2" "$1" 2>/tmp/stderr
43
+ # check for bad return status
44
+ test $? -ne 0 && return 1
45
+ return 0
46
+ }
47
+
48
+ # do_perl URL FILENAME
49
+ do_perl() {
50
+ echo "trying perl..."
51
+ perl -e "use LWP::Simple; getprint($ARGV[0]);" "$1" > "$2"
52
+ # check for bad return status
53
+ test $? -ne 0 && return 1
54
+ # check for bad output or empty file
55
+ # grep "The specified key does not exist." "$2" 2>&1 >/dev/null
56
+ # if test $? -eq 0 || test ! -s "$2"; then
57
+ # unable_to_retrieve_package
58
+ # fi
59
+ return 0
60
+ }
61
+
62
+ # do_python URL FILENAME
63
+ do_python() {
64
+ echo "trying python..."
65
+ python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2"
66
+ # check for bad return status
67
+ test $? -ne 0 && return 1
68
+ # check for bad output or empty file
69
+ #grep "The specified key does not exist." "$2" 2>&1 >/dev/null
70
+ #if test $? -eq 0 || test ! -s "$2"; then
71
+ # unable_to_retrieve_package
72
+ #fi
73
+ return 0
74
+ }
75
+
76
+ # do_download URL FILENAME
77
+ do_download() {
78
+ PATH=/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
79
+ export PATH
80
+
81
+ echo "downloading $1"
82
+ echo " to file $2"
83
+
84
+ # we try all of these until we get success.
85
+ # perl, in particular may be present but LWP::Simple may not be installed
86
+
87
+ if exists wget; then
88
+ do_wget $1 $2 && return 0
89
+ fi
90
+
91
+ if exists curl; then
92
+ do_curl $1 $2 && return 0
93
+ fi
94
+
95
+ if exists fetch; then
96
+ do_fetch $1 $2 && return 0
97
+ fi
98
+
99
+ if exists perl; then
100
+ do_perl $1 $2 && return 0
101
+ fi
102
+
103
+ if exists python; then
104
+ do_python $1 $2 && return 0
105
+ fi
106
+
107
+ echo ">>>>>> wget, curl, fetch, perl or python not found on this instance."
108
+ return 16
109
+ }
@@ -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-----
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / Unreleased
2
+
3
+ * Initial release
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,64 @@
1
+ # <a name="title"></a> Kitchen::<%= config[:klass_name] %>
2
+
3
+ A Test Kitchen Driver for <%= config[:klass_name] %>.
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 [<%= config[:author] %>][author] (<<%= config[:email] %>>)
53
+
54
+ ## <a name="license"></a> License
55
+
56
+ <%= config[:license_string] %> (see [LICENSE][license])
57
+
58
+
59
+ [author]: https://github.com/enter-github-user
60
+ [issues]: https://github.com/enter-github-user/<%= config[:gem_name] %>/issues
61
+ [license]: https://github.com/enter-github-user/<%= config[:gem_name] %>/blob/master/LICENSE
62
+ [repo]: https://github.com/enter-github-user/<%= config[:gem_name] %>
63
+ [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
64
+ [chef_omnibus_dl]: http://www.chef.io/chef/install/