test-kitchen 1.4.0.beta.2 → 1.4.0.rc.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 +46 -0
- data/features/kitchen_diagnose_command.feature +32 -0
- data/lib/kitchen/cli.rb +3 -0
- data/lib/kitchen/command/diagnose.rb +6 -1
- data/lib/kitchen/configurable.rb +48 -1
- data/lib/kitchen/diagnostic.rb +29 -0
- data/lib/kitchen/driver/base.rb +25 -0
- data/lib/kitchen/driver/dummy.rb +4 -0
- data/lib/kitchen/driver/proxy.rb +3 -0
- data/lib/kitchen/instance.rb +17 -0
- data/lib/kitchen/provisioner/base.rb +30 -1
- data/lib/kitchen/provisioner/chef_base.rb +7 -3
- data/lib/kitchen/provisioner/chef_solo.rb +4 -0
- data/lib/kitchen/provisioner/chef_zero.rb +5 -1
- data/lib/kitchen/provisioner/dummy.rb +4 -0
- data/lib/kitchen/provisioner/shell.rb +5 -0
- data/lib/kitchen/shell_out.rb +6 -2
- data/lib/kitchen/transport/base.rb +25 -0
- data/lib/kitchen/transport/dummy.rb +4 -0
- data/lib/kitchen/transport/ssh.rb +22 -1
- data/lib/kitchen/transport/winrm.rb +61 -90
- data/lib/kitchen/verifier/base.rb +30 -1
- data/lib/kitchen/verifier/busser.rb +4 -0
- data/lib/kitchen/verifier/dummy.rb +4 -0
- data/lib/kitchen/version.rb +1 -1
- data/spec/kitchen/configurable_spec.rb +35 -0
- data/spec/kitchen/diagnostic_spec.rb +53 -3
- data/spec/kitchen/driver/dummy_spec.rb +8 -0
- data/spec/kitchen/driver/proxy_spec.rb +4 -0
- data/spec/kitchen/driver/ssh_base_spec.rb +4 -0
- data/spec/kitchen/instance_spec.rb +75 -0
- data/spec/kitchen/provisioner/base_spec.rb +32 -6
- data/spec/kitchen/provisioner/chef_base_spec.rb +3 -2
- data/spec/kitchen/provisioner/chef_solo_spec.rb +10 -2
- data/spec/kitchen/provisioner/chef_zero_spec.rb +24 -2
- data/spec/kitchen/provisioner/dummy_spec.rb +8 -0
- data/spec/kitchen/provisioner/shell_spec.rb +10 -0
- data/spec/kitchen/shell_out_spec.rb +7 -0
- data/spec/kitchen/transport/ssh_spec.rb +90 -1
- data/spec/kitchen/transport/winrm_spec.rb +91 -11
- data/spec/kitchen/verifier/base_spec.rb +32 -6
- data/spec/kitchen/verifier/busser_spec.rb +8 -0
- data/spec/kitchen/verifier/dummy_spec.rb +8 -0
- data/support/chef_base_install_command.sh +183 -100
- data/test-kitchen.gemspec +1 -2
- metadata +11 -48
- data/lib/kitchen/transport/winrm/command_executor.rb +0 -188
- data/lib/kitchen/transport/winrm/file_transporter.rb +0 -454
- data/lib/kitchen/transport/winrm/logging.rb +0 -50
- data/lib/kitchen/transport/winrm/template.rb +0 -74
- data/lib/kitchen/transport/winrm/tmp_zip.rb +0 -187
- data/spec/kitchen/transport/winrm/command_executor_spec.rb +0 -400
- data/spec/kitchen/transport/winrm/file_transporter_spec.rb +0 -876
- data/spec/kitchen/transport/winrm/logging_spec.rb +0 -92
- data/spec/kitchen/transport/winrm/template_spec.rb +0 -51
- data/spec/kitchen/transport/winrm/tmp_zip_spec.rb +0 -132
- data/support/check_files.ps1.erb +0 -48
- data/support/decode_files.ps1.erb +0 -62
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39ee6b34f700deb8d41ee3f4afd2ce7e42b4dd32
|
|
4
|
+
data.tar.gz: 7d31a8ecb34472780a7c946be2bd9ff25725ba6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f118ebfd3d1b09b230bf91714086ed26b97611ec8e141d61f58727aaf4163ef29c09b3f6d6bcc9dd8f263c17483d2fff7dbbcf1a3b453387d42ac0c76a90bf2d
|
|
7
|
+
data.tar.gz: 0cbdfdb1514b8340b4476ec9060a1eaacb3ca7f24924e4d56f87b9af0c38eece989e427f2deae0d6209c73bef709fd3ee7bcfd2c735a7475ec7d337be2cb705c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## 1.4.0.rc.1 / 2015-03-29
|
|
2
|
+
|
|
3
|
+
### Potentially breaking changes
|
|
4
|
+
|
|
5
|
+
* Pull request [#672][]: Extract WinRM-dependant code from Transport::Winrm into the winrm-transport gem, meaning that WinRM support is now a soft dependency of Test Kitchen, similar to Berkshelf and Librarian-Chef. This means the first time a Winrm Transport is requested, a `kitchen` command will crash with a UserError message instructing the user to install the winrm-transport gem. Existing projects which do not use the Winrm Transport will be unaffected and have no extra gem dependenices to manage. ([@fnichol][])
|
|
6
|
+
|
|
7
|
+
### Bug fixes
|
|
8
|
+
|
|
9
|
+
* Issue [#656][], pull request 669: Move ObjectSpace finalizer logic into CommandExtractor to close the last opened remote shell on shutdown for Winrm Transport. ([@fnichol][])
|
|
10
|
+
* Issue [#611][], pull request [#673][]: Ensure that secret key is deleted before converge for chef_zero and chef_solo Provisioners. ([@fnichol][])
|
|
11
|
+
* Issue [#389][], pull request [#674][]: Expand path for `:ssh_key` if provided in kitchen.yml for Ssh Transport. ([@fnichol][])
|
|
12
|
+
* Pull request [#653][]: Consider `:require_chef_omnibus = 11` to be a modern version for Chef Provisioners. ([@fnichol][])
|
|
13
|
+
|
|
14
|
+
### New features
|
|
15
|
+
|
|
16
|
+
* Add [API versioning](d8f1a7db9e506c44f321462e1fba0b1e24994070) metadata to all plugin types. ([@fnichol][])
|
|
17
|
+
* Pull request [#667][], pull request [#668][]: Add plugin diagnostics, exposed via `kitchen diagnose`. ([@fnichol][])
|
|
18
|
+
* Pull request [#675][], issue [#424][]: Add default `:compression` & `:compression_level` configuration attributes to Ssh Transport.
|
|
19
|
+
* Pull request [#651][], issue [#592][], issue [#629][], issue [#307][]: Add :sudo_command to Provisioners, Verifiers, & ShellOut. ([@fnichol][])
|
|
20
|
+
|
|
21
|
+
### Improvements
|
|
22
|
+
|
|
23
|
+
* Pull request [#658][], issue [#654][]: Updated for sh compatibility based on install.sh code which supports more platforms includig Solaris. ([@scotthain][], [@curiositycasualty][], [@fnichol][])
|
|
24
|
+
* Pull request [#652][], pull request [#666][], issue [#556][]: Support symbol values in solo.rb & client.rb for chef_zero and chef_solo Provisioners. ([@fnichol][])
|
|
25
|
+
|
|
26
|
+
|
|
1
27
|
## 1.4.0.beta.2 / 2015-03-25
|
|
2
28
|
|
|
3
29
|
### Potentially breaking changes
|
|
@@ -571,6 +597,7 @@ The initial release.
|
|
|
571
597
|
[#304]: https://github.com/test-kitchen/test-kitchen/issues/304
|
|
572
598
|
[#305]: https://github.com/test-kitchen/test-kitchen/issues/305
|
|
573
599
|
[#306]: https://github.com/test-kitchen/test-kitchen/issues/306
|
|
600
|
+
[#307]: https://github.com/test-kitchen/test-kitchen/issues/307
|
|
574
601
|
[#309]: https://github.com/test-kitchen/test-kitchen/issues/309
|
|
575
602
|
[#310]: https://github.com/test-kitchen/test-kitchen/issues/310
|
|
576
603
|
[#313]: https://github.com/test-kitchen/test-kitchen/issues/313
|
|
@@ -587,9 +614,11 @@ The initial release.
|
|
|
587
614
|
[#373]: https://github.com/test-kitchen/test-kitchen/issues/373
|
|
588
615
|
[#375]: https://github.com/test-kitchen/test-kitchen/issues/375
|
|
589
616
|
[#381]: https://github.com/test-kitchen/test-kitchen/issues/381
|
|
617
|
+
[#389]: https://github.com/test-kitchen/test-kitchen/issues/389
|
|
590
618
|
[#397]: https://github.com/test-kitchen/test-kitchen/issues/397
|
|
591
619
|
[#399]: https://github.com/test-kitchen/test-kitchen/issues/399
|
|
592
620
|
[#416]: https://github.com/test-kitchen/test-kitchen/issues/416
|
|
621
|
+
[#424]: https://github.com/test-kitchen/test-kitchen/issues/424
|
|
593
622
|
[#427]: https://github.com/test-kitchen/test-kitchen/issues/427
|
|
594
623
|
[#429]: https://github.com/test-kitchen/test-kitchen/issues/429
|
|
595
624
|
[#431]: https://github.com/test-kitchen/test-kitchen/issues/431
|
|
@@ -617,6 +646,7 @@ The initial release.
|
|
|
617
646
|
[#549]: https://github.com/test-kitchen/test-kitchen/issues/549
|
|
618
647
|
[#554]: https://github.com/test-kitchen/test-kitchen/issues/554
|
|
619
648
|
[#555]: https://github.com/test-kitchen/test-kitchen/issues/555
|
|
649
|
+
[#556]: https://github.com/test-kitchen/test-kitchen/issues/556
|
|
620
650
|
[#557]: https://github.com/test-kitchen/test-kitchen/issues/557
|
|
621
651
|
[#558]: https://github.com/test-kitchen/test-kitchen/issues/558
|
|
622
652
|
[#567]: https://github.com/test-kitchen/test-kitchen/issues/567
|
|
@@ -624,10 +654,26 @@ The initial release.
|
|
|
624
654
|
[#580]: https://github.com/test-kitchen/test-kitchen/issues/580
|
|
625
655
|
[#581]: https://github.com/test-kitchen/test-kitchen/issues/581
|
|
626
656
|
[#588]: https://github.com/test-kitchen/test-kitchen/issues/588
|
|
657
|
+
[#592]: https://github.com/test-kitchen/test-kitchen/issues/592
|
|
627
658
|
[#600]: https://github.com/test-kitchen/test-kitchen/issues/600
|
|
659
|
+
[#611]: https://github.com/test-kitchen/test-kitchen/issues/611
|
|
660
|
+
[#629]: https://github.com/test-kitchen/test-kitchen/issues/629
|
|
628
661
|
[#633]: https://github.com/test-kitchen/test-kitchen/issues/633
|
|
629
662
|
[#648]: https://github.com/test-kitchen/test-kitchen/issues/648
|
|
630
663
|
[#649]: https://github.com/test-kitchen/test-kitchen/issues/649
|
|
664
|
+
[#651]: https://github.com/test-kitchen/test-kitchen/issues/651
|
|
665
|
+
[#652]: https://github.com/test-kitchen/test-kitchen/issues/652
|
|
666
|
+
[#653]: https://github.com/test-kitchen/test-kitchen/issues/653
|
|
667
|
+
[#654]: https://github.com/test-kitchen/test-kitchen/issues/654
|
|
668
|
+
[#656]: https://github.com/test-kitchen/test-kitchen/issues/656
|
|
669
|
+
[#658]: https://github.com/test-kitchen/test-kitchen/issues/658
|
|
670
|
+
[#666]: https://github.com/test-kitchen/test-kitchen/issues/666
|
|
671
|
+
[#667]: https://github.com/test-kitchen/test-kitchen/issues/667
|
|
672
|
+
[#668]: https://github.com/test-kitchen/test-kitchen/issues/668
|
|
673
|
+
[#672]: https://github.com/test-kitchen/test-kitchen/issues/672
|
|
674
|
+
[#673]: https://github.com/test-kitchen/test-kitchen/issues/673
|
|
675
|
+
[#674]: https://github.com/test-kitchen/test-kitchen/issues/674
|
|
676
|
+
[#675]: https://github.com/test-kitchen/test-kitchen/issues/675
|
|
631
677
|
[@ChrisLundquist]: https://github.com/ChrisLundquist
|
|
632
678
|
[@MarkGibbons]: https://github.com/MarkGibbons
|
|
633
679
|
[@adamhjk]: https://github.com/adamhjk
|
|
@@ -13,6 +13,12 @@ Feature: Running a diagnosis command
|
|
|
13
13
|
provisioner:
|
|
14
14
|
name: dummy
|
|
15
15
|
|
|
16
|
+
transport:
|
|
17
|
+
name: dummy
|
|
18
|
+
|
|
19
|
+
verifier:
|
|
20
|
+
name: dummy
|
|
21
|
+
|
|
16
22
|
platforms:
|
|
17
23
|
- name: cool
|
|
18
24
|
- name: beans
|
|
@@ -22,9 +28,20 @@ Feature: Running a diagnosis command
|
|
|
22
28
|
- name: server
|
|
23
29
|
"""
|
|
24
30
|
|
|
31
|
+
@spawn
|
|
32
|
+
Scenario: Displaying help
|
|
33
|
+
When I run `kitchen help diagnose`
|
|
34
|
+
Then the output should contain:
|
|
35
|
+
"""
|
|
36
|
+
Usage:
|
|
37
|
+
kitchen diagnose
|
|
38
|
+
"""
|
|
39
|
+
And the exit status should be 0
|
|
40
|
+
|
|
25
41
|
@spawn
|
|
26
42
|
Scenario: Showing all instances
|
|
27
43
|
When I run `kitchen diagnose`
|
|
44
|
+
Then the output should contain "timestamp: "
|
|
28
45
|
Then the output should contain "kitchen_version: "
|
|
29
46
|
Then the output should contain " client-cool:"
|
|
30
47
|
Then the output should contain " client-beans:"
|
|
@@ -44,6 +61,16 @@ Feature: Running a diagnosis command
|
|
|
44
61
|
"""
|
|
45
62
|
And the exit status should be 0
|
|
46
63
|
|
|
64
|
+
@spawn
|
|
65
|
+
Scenario: Showing all instances with plugin configuration
|
|
66
|
+
When I run `kitchen diagnose --plugins`
|
|
67
|
+
Then the output should contain "plugins:"
|
|
68
|
+
Then the output should contain " class: Kitchen::Driver::Dummy"
|
|
69
|
+
Then the output should contain " class: Kitchen::Provisioner::Dummy"
|
|
70
|
+
Then the output should contain " class: Kitchen::Transport::Dummy"
|
|
71
|
+
Then the output should contain " class: Kitchen::Verifier::Dummy"
|
|
72
|
+
And the exit status should be 0
|
|
73
|
+
|
|
47
74
|
@spawn
|
|
48
75
|
Scenario: Coping with loading failure
|
|
49
76
|
Given a file named ".kitchen.local.yml" with:
|
|
@@ -61,4 +88,9 @@ Feature: Running a diagnosis command
|
|
|
61
88
|
instances:
|
|
62
89
|
error:
|
|
63
90
|
"""
|
|
91
|
+
And the output should contain:
|
|
92
|
+
"""
|
|
93
|
+
plugins:
|
|
94
|
+
error:
|
|
95
|
+
"""
|
|
64
96
|
And the exit status should be 0
|
data/lib/kitchen/cli.rb
CHANGED
|
@@ -112,6 +112,9 @@ module Kitchen
|
|
|
112
112
|
method_option :loader,
|
|
113
113
|
:type => :boolean,
|
|
114
114
|
:desc => "Include data loader diagnostics"
|
|
115
|
+
method_option :plugins,
|
|
116
|
+
:type => :boolean,
|
|
117
|
+
:desc => "Include plugin diagnostics"
|
|
115
118
|
method_option :instances,
|
|
116
119
|
:type => :boolean,
|
|
117
120
|
:default => true,
|
|
@@ -37,11 +37,16 @@ module Kitchen
|
|
|
37
37
|
loader = record_failure { load_loader }
|
|
38
38
|
|
|
39
39
|
puts Kitchen::Diagnostic.new(
|
|
40
|
-
:loader => loader, :instances => instances
|
|
40
|
+
:loader => loader, :instances => instances, :plugins => plugins?
|
|
41
|
+
).read.to_yaml
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
private
|
|
44
45
|
|
|
46
|
+
def plugins?
|
|
47
|
+
options[:all] || options[:plugins]
|
|
48
|
+
end
|
|
49
|
+
|
|
45
50
|
# Loads and returns instances if they are requested.
|
|
46
51
|
#
|
|
47
52
|
# @return [Array<Instance>] an array of instances or an empty array
|
data/lib/kitchen/configurable.rb
CHANGED
|
@@ -124,6 +124,18 @@ module Kitchen
|
|
|
124
124
|
result
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
+
# Returns a Hash of configuration and other useful diagnostic information
|
|
128
|
+
# associated with the plugin itself (such as loaded version, class name,
|
|
129
|
+
# etc.).
|
|
130
|
+
#
|
|
131
|
+
# @return [Hash] a diagnostic hash
|
|
132
|
+
def diagnose_plugin
|
|
133
|
+
result = Hash.new
|
|
134
|
+
result[:name] = name
|
|
135
|
+
result.merge!(self.class.diagnose)
|
|
136
|
+
result
|
|
137
|
+
end
|
|
138
|
+
|
|
127
139
|
# Returns the name of this plugin, suitable for display in a CLI.
|
|
128
140
|
#
|
|
129
141
|
# @return [String] name of this plugin
|
|
@@ -195,7 +207,7 @@ module Kitchen
|
|
|
195
207
|
expanded_paths = LazyHash.new(self.class.expanded_paths, self).to_hash
|
|
196
208
|
|
|
197
209
|
expanded_paths.each do |key, should_expand|
|
|
198
|
-
next if !should_expand || config[key].nil?
|
|
210
|
+
next if !should_expand || config[key].nil? || config[key] == false
|
|
199
211
|
|
|
200
212
|
config[key] = if config[key].is_a?(Array)
|
|
201
213
|
config[key].map { |path| File.expand_path(path, root_path) }
|
|
@@ -303,6 +315,41 @@ module Kitchen
|
|
|
303
315
|
# Class methods which will be mixed in on inclusion of Configurable module.
|
|
304
316
|
module ClassMethods
|
|
305
317
|
|
|
318
|
+
# Sets the loaded version of this plugin, usually corresponding to the
|
|
319
|
+
# RubyGems version of the plugin's library. If the plugin does not set
|
|
320
|
+
# this value, then `nil` will be used and reported.
|
|
321
|
+
#
|
|
322
|
+
# @example setting a version used by RubyGems
|
|
323
|
+
#
|
|
324
|
+
# require "kitchen/driver/vagrant_version"
|
|
325
|
+
#
|
|
326
|
+
# module Kitchen
|
|
327
|
+
# module Driver
|
|
328
|
+
# class Vagrant < Kitchen::Driver::Base
|
|
329
|
+
#
|
|
330
|
+
# plugin_version Kitchen::Driver::VAGRANT_VERSION
|
|
331
|
+
#
|
|
332
|
+
# end
|
|
333
|
+
# end
|
|
334
|
+
# end
|
|
335
|
+
#
|
|
336
|
+
# @param version [String] a version string
|
|
337
|
+
def plugin_version(version) # rubocop:disable Style/TrivialAccessors
|
|
338
|
+
@plugin_version = version
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# Returns a Hash of configuration and other useful diagnostic
|
|
342
|
+
# information.
|
|
343
|
+
#
|
|
344
|
+
# @return [Hash] a diagnostic hash
|
|
345
|
+
def diagnose
|
|
346
|
+
{
|
|
347
|
+
:class => name,
|
|
348
|
+
:version => @plugin_version,
|
|
349
|
+
:api_version => @api_version
|
|
350
|
+
}
|
|
351
|
+
end
|
|
352
|
+
|
|
306
353
|
# Sets a sane default value for a configuration attribute. These values
|
|
307
354
|
# can be overridden by provided configuration or in a subclass with
|
|
308
355
|
# another default_config declaration.
|
data/lib/kitchen/diagnostic.rb
CHANGED
|
@@ -35,9 +35,12 @@ module Kitchen
|
|
|
35
35
|
# to `#diagnose` or an error Hash
|
|
36
36
|
# @option options [Array<#diagnose>,Hash] :instances an Array of instances
|
|
37
37
|
# that respond to `#diagnose` or an error Hash
|
|
38
|
+
# @option options [true,false] :plugins whether or not plugins should be
|
|
39
|
+
# returned
|
|
38
40
|
def initialize(options = {})
|
|
39
41
|
@loader = options.fetch(:loader, nil)
|
|
40
42
|
@instances = options.fetch(:instances, [])
|
|
43
|
+
@plugins = options.fetch(:plugins, false)
|
|
41
44
|
@result = Hash.new
|
|
42
45
|
end
|
|
43
46
|
|
|
@@ -46,6 +49,7 @@ module Kitchen
|
|
|
46
49
|
# @return [Hash] a configuration Hash
|
|
47
50
|
def read
|
|
48
51
|
prepare_common
|
|
52
|
+
prepare_plugins
|
|
49
53
|
prepare_loader
|
|
50
54
|
prepare_instances
|
|
51
55
|
|
|
@@ -87,6 +91,31 @@ module Kitchen
|
|
|
87
91
|
end
|
|
88
92
|
end
|
|
89
93
|
|
|
94
|
+
# Adds plugin information to the result Hash.
|
|
95
|
+
#
|
|
96
|
+
# @api private
|
|
97
|
+
def prepare_plugins
|
|
98
|
+
return unless @plugins
|
|
99
|
+
|
|
100
|
+
if error_hash?(instances)
|
|
101
|
+
result[:plugins] = { :error => instances[:error] }
|
|
102
|
+
elsif instances.empty?
|
|
103
|
+
result[:plugins] = Hash.new
|
|
104
|
+
else
|
|
105
|
+
plugins = {
|
|
106
|
+
:driver => [], :provisioner => [], :transport => [], :verifier => []
|
|
107
|
+
}
|
|
108
|
+
instances.map(&:diagnose_plugins).each do |plugin_hash|
|
|
109
|
+
plugin_hash.each { |type, plugin| plugins[type] << plugin }
|
|
110
|
+
end
|
|
111
|
+
plugins.each do |type, list|
|
|
112
|
+
plugins[type] =
|
|
113
|
+
Hash[list.uniq.map { |hash| [hash.delete(:name), hash] }]
|
|
114
|
+
end
|
|
115
|
+
result[:plugins] = plugins
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
90
119
|
# Adds instance information to the result Hash.
|
|
91
120
|
#
|
|
92
121
|
# @api private
|
data/lib/kitchen/driver/base.rb
CHANGED
|
@@ -89,6 +89,31 @@ module Kitchen
|
|
|
89
89
|
@serial_actions += methods
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
# Sets the API version for this driver. If the driver does not set this
|
|
93
|
+
# value, then `nil` will be used and reported.
|
|
94
|
+
#
|
|
95
|
+
# Sets the API version for this driver
|
|
96
|
+
#
|
|
97
|
+
# @example setting an API version
|
|
98
|
+
#
|
|
99
|
+
# module Kitchen
|
|
100
|
+
# module Driver
|
|
101
|
+
# class NewDriver < Kitchen::Driver::Base
|
|
102
|
+
#
|
|
103
|
+
# kitchen_driver_api_version 2
|
|
104
|
+
#
|
|
105
|
+
# end
|
|
106
|
+
# end
|
|
107
|
+
# end
|
|
108
|
+
#
|
|
109
|
+
# @param version [Integer,String] a version number
|
|
110
|
+
#
|
|
111
|
+
# rubocop:disable Style/TrivialAccessors
|
|
112
|
+
def self.kitchen_driver_api_version(version)
|
|
113
|
+
@api_version = version
|
|
114
|
+
end
|
|
115
|
+
# rubocop:enable Style/TrivialAccessors
|
|
116
|
+
|
|
92
117
|
private
|
|
93
118
|
|
|
94
119
|
# Intercepts any bare #puts calls in subclasses and issues an INFO log
|
data/lib/kitchen/driver/dummy.rb
CHANGED
data/lib/kitchen/driver/proxy.rb
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#
|
|
20
20
|
|
|
21
21
|
require "kitchen"
|
|
22
|
+
require "kitchen/version"
|
|
22
23
|
|
|
23
24
|
module Kitchen
|
|
24
25
|
|
|
@@ -33,6 +34,8 @@ module Kitchen
|
|
|
33
34
|
# @author Seth Chisamore <schisamo@opscode.com>
|
|
34
35
|
class Proxy < Kitchen::Driver::SSHBase
|
|
35
36
|
|
|
37
|
+
plugin_version Kitchen::VERSION
|
|
38
|
+
|
|
36
39
|
required_config :host
|
|
37
40
|
required_config :reset_command
|
|
38
41
|
|
data/lib/kitchen/instance.rb
CHANGED
|
@@ -243,6 +243,23 @@ module Kitchen
|
|
|
243
243
|
result
|
|
244
244
|
end
|
|
245
245
|
|
|
246
|
+
# Returns a Hash of configuration and other useful diagnostic information
|
|
247
|
+
# associated with plugins (such as loaded version, class name, etc.).
|
|
248
|
+
#
|
|
249
|
+
# @return [Hash] a diagnostic hash
|
|
250
|
+
def diagnose_plugins
|
|
251
|
+
result = Hash.new
|
|
252
|
+
[:driver, :provisioner, :verifier, :transport].each do |sym|
|
|
253
|
+
obj = send(sym)
|
|
254
|
+
result[sym] = if obj.respond_to?(:diagnose_plugin)
|
|
255
|
+
obj.diagnose_plugin
|
|
256
|
+
else
|
|
257
|
+
:unknown
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
result
|
|
261
|
+
end
|
|
262
|
+
|
|
246
263
|
# Returns the last successfully completed action state of the instance.
|
|
247
264
|
#
|
|
248
265
|
# @return [String] a named action which was last successfully completed
|
|
@@ -40,6 +40,10 @@ module Kitchen
|
|
|
40
40
|
provisioner.windows_os? ? nil : true
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
default_config :sudo_command do |provisioner|
|
|
44
|
+
provisioner.windows_os? ? nil : "sudo -E"
|
|
45
|
+
end
|
|
46
|
+
|
|
43
47
|
expand_path_for :test_base_path
|
|
44
48
|
|
|
45
49
|
# Constructs a new provisioner by providing a configuration hash.
|
|
@@ -153,6 +157,31 @@ module Kitchen
|
|
|
153
157
|
FileUtils.rmtree(sandbox_path)
|
|
154
158
|
end
|
|
155
159
|
|
|
160
|
+
# Sets the API version for this provisioner. If the provisioner does not
|
|
161
|
+
# set this value, then `nil` will be used and reported.
|
|
162
|
+
#
|
|
163
|
+
# Sets the API version for this provisioner
|
|
164
|
+
#
|
|
165
|
+
# @example setting an API version
|
|
166
|
+
#
|
|
167
|
+
# module Kitchen
|
|
168
|
+
# module Provisioner
|
|
169
|
+
# class NewProvisioner < Kitchen::Provisioner::Base
|
|
170
|
+
#
|
|
171
|
+
# kitchen_provisioner_api_version 2
|
|
172
|
+
#
|
|
173
|
+
# end
|
|
174
|
+
# end
|
|
175
|
+
# end
|
|
176
|
+
#
|
|
177
|
+
# @param version [Integer,String] a version number
|
|
178
|
+
#
|
|
179
|
+
# rubocop:disable Style/TrivialAccessors
|
|
180
|
+
def self.kitchen_provisioner_api_version(version)
|
|
181
|
+
@api_version = version
|
|
182
|
+
end
|
|
183
|
+
# rubocop:enable Style/TrivialAccessors
|
|
184
|
+
|
|
156
185
|
private
|
|
157
186
|
|
|
158
187
|
# Builds a complete command given a variables String preamble and a file
|
|
@@ -179,7 +208,7 @@ module Kitchen
|
|
|
179
208
|
# @return [String] the command, conditionaly prefixed with sudo
|
|
180
209
|
# @api private
|
|
181
210
|
def sudo(script)
|
|
182
|
-
config[:sudo] ? "
|
|
211
|
+
config[:sudo] ? "#{config[:sudo_command]} #{script}" : script
|
|
183
212
|
end
|
|
184
213
|
end
|
|
185
214
|
end
|
|
@@ -118,8 +118,10 @@ module Kitchen
|
|
|
118
118
|
|
|
119
119
|
# (see Base#init_command)
|
|
120
120
|
def init_command
|
|
121
|
-
dirs = %w[
|
|
122
|
-
|
|
121
|
+
dirs = %w[
|
|
122
|
+
cookbooks data data_bags environments roles clients
|
|
123
|
+
encrypted_data_bag_secret
|
|
124
|
+
].sort.map { |dir| remote_path_join(config[:root_path], dir) }
|
|
123
125
|
|
|
124
126
|
vars = if powershell_shell?
|
|
125
127
|
init_command_vars_for_powershell(dirs)
|
|
@@ -212,7 +214,9 @@ module Kitchen
|
|
|
212
214
|
# @return [String] a string representation
|
|
213
215
|
# @api private
|
|
214
216
|
def format_value(obj)
|
|
215
|
-
if obj.is_a?(String)
|
|
217
|
+
if obj.is_a?(String) && obj =~ /^:/
|
|
218
|
+
obj
|
|
219
|
+
elsif obj.is_a?(String)
|
|
216
220
|
%{"#{obj.gsub(/\\/, "\\\\\\\\")}"}
|
|
217
221
|
elsif obj.is_a?(Array)
|
|
218
222
|
%{[#{obj.map { |i| format_value(i) }.join(", ")}]}
|