Skip to content

Commit

Permalink
Allow transports which are subclasses of the core ones.
Browse files Browse the repository at this point in the history
Also fixes the hilariously wrong exception.
  • Loading branch information
coderanger committed Jan 14, 2016
1 parent 7b48d5e commit c6cc281
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/kitchen/verifier/inspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'kitchen/transport/ssh'
require 'kitchen/transport/winrm'
require 'kitchen/verifier/inspec_version'
require 'kitchen/verifier/base'

Expand All @@ -35,17 +37,12 @@ class Inspec < Kitchen::Verifier::Base
def call(state)
transport_data = instance.transport.diagnose.merge(state)

runner_options = case (name = instance.transport.name.downcase)
when 'ssh'
runner_options = if instance.transport.is_a?(Kitchen::Transport::Ssh)
runner_options_for_ssh(transport_data)
when 'winrm'
elsif instance.transport.is_a?(Kitchen::Transport::Winrm)
runner_options_for_winrm(transport_data)
else
fail(
Kitchen::UserError,
"Verifier #{name}",
" does not support the #{name} Transport",
)
raise Kitchen::UserError.new("Verifier #{name} does not support the #{instance.transport.name} Transport")
end
runner_options['format'] = config[:format] unless config[:format].nil?

Expand Down

0 comments on commit c6cc281

Please sign in to comment.