Giter VIP home page Giter VIP logo

Comments (10)

jbussdieker-quiknode avatar jbussdieker-quiknode commented on June 25, 2024 1

I'm guessing the logger the exception is using doesn't exist which raises an exception inside the handler.

I tested the theory and it worked:

diff --git a/kitchen-docker-2.12.0/lib/docker/version.rb b/kitchen-docker-2.12.0/lib/docker/version.rb
index 70fd25e..ed32290 100644
--- a/kitchen-docker-2.12.0/lib/docker/version.rb
+++ b/kitchen-docker-2.12.0/lib/docker/version.rb
@@ -21,5 +21,5 @@ begin
     API_VERSION = '1.24'
   end
 rescue LoadError => e
-  logger.debug("[Docker] docker-api gem not found for InSpec verifier. #{e}")
+  puts("[Docker] docker-api gem not found for InSpec verifier. #{e}")
 end
diff --git a/kitchen-docker-2.12.0/lib/kitchen/docker/helpers/inspec_helper.rb b/kitchen-docker-2.12.0/lib/kitchen/docker/helpers/inspec_helper.rb
index 5f0d325..f662543 100644
--- a/kitchen-docker-2.12.0/lib/kitchen/docker/helpers/inspec_helper.rb
+++ b/kitchen-docker-2.12.0/lib/kitchen/docker/helpers/inspec_helper.rb
@@ -36,5 +36,5 @@ begin
     end
   end
 rescue LoadError => e
-  logger.debug("[Docker] kitchen-inspec gem not found for InSpec verifier. #{e}")
+  puts("[Docker] kitchen-inspec gem not found for InSpec verifier. #{e}")^M
 end
diff --git a/kitchen-docker-2.12.0/lib/kitchen/transport/docker.rb b/kitchen-docker-2.12.0/lib/kitchen/transport/docker.rb
index de31807..e262814 100644
--- a/kitchen-docker-2.12.0/lib/kitchen/transport/docker.rb
+++ b/kitchen-docker-2.12.0/lib/kitchen/transport/docker.rb
@@ -80,7 +80,11 @@ module Kitchen

       class Connection < Kitchen::Transport::Docker::Connection
         # Include the InSpec patches to be able to execute tests on Windows containers
-        include Kitchen::Docker::Helpers::InspecHelper
+        begin
+          include Kitchen::Docker::Helpers::InspecHelper
+        rescue Exception => e
+          puts("Error")
+        end

         def execute(command)
           return if command.nil?
diff --git a/kitchen-docker-2.12.0/lib/train/docker.rb b/kitchen-docker-2.12.0/lib/train/docker.rb
index 024caae..1fb80b9 100644
--- a/kitchen-docker-2.12.0/lib/train/docker.rb
+++ b/kitchen-docker-2.12.0/lib/train/docker.rb
@@ -121,5 +121,5 @@ begin
     end
   end
 rescue LoadError => e
-  logger.debug("[Docker] train gem not found for InSpec verifier. #{e}")
+  puts("[Docker] train gem not found for InSpec verifier. #{e}")
 end

from kitchen-docker.

randled-re avatar randled-re commented on June 25, 2024

+1

Also tried rolling back kitchen and kitchen-docker from every version to v1 release and same error.

Also input the env_variables at driver and transport layer for logger and same error running docker 19.03.13-ce on arch

from kitchen-docker.

don-code avatar don-code commented on June 25, 2024

I encountered this issue on test-kitchen 2.5.4 (I need the old version for Chef 12 / Ruby 2.3.6 compatibility) and kitchen-docker 2.10.0, but was able to fix it by backing down to kitchen-docker 2.8.0.

from kitchen-docker.

streambinder avatar streambinder commented on June 25, 2024

It doesn't seem to work either:

$ bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using bundler 2.2.2
[...]
Fetching test-kitchen 2.11.1
Installing test-kitchen 2.11.1
Fetching kitchen-salt 0.6.3
Fetching kitchen-sync 2.2.1
Fetching kitchen-docker 2.8.0
Installing kitchen-salt 0.6.3
Installing kitchen-sync 2.2.1
Installing kitchen-docker 2.8.0
Bundle complete! 4 Gemfile dependencies, 47 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ kitchen test
-----> Starting Test Kitchen (v2.11.1)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ClientError
>>>>>> Message: Could not load the 'docker' transport from the load path. Did you mean: dummy, exec, runtests, ssh, winrm ? Please ensure that your transport is installed as a gem or included in your Gemfile if using Bundler.
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ClientError
>>>>>> Message: Could not load the 'docker' transport from the load path. Did you mean: dummy, exec, runtests, ssh, winrm ? Please ensure that your transport is installed as a gem or included in your Gemfile if using Bundler.
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
ERROR: Job failed: exit code 20

from kitchen-docker.

jbussdieker-quiknode avatar jbussdieker-quiknode commented on June 25, 2024

This seems to fail around the require_relative '../docker/helpers/inspec_helper' line in kitchen-docker-2.12.0/lib/kitchen/transport/docker.rb. Adding kitchen-inspec to my Gemfile fixed it.

from kitchen-docker.

RulerOf avatar RulerOf commented on June 25, 2024

@jbussdieker-quiknode Odd... I would have to run this scenario through the debugger (and I will if I ever tackle this issue) but the file you pointed to wraps the require into a begin block and catches the LoadError. I wouldn't expect it to cause this failure.

Thanks for the lead though. I was unable to reproduce this when I looked at it several months back.

from kitchen-docker.

jbussdieker-quiknode avatar jbussdieker-quiknode commented on June 25, 2024

Oddly enough that line wasn't specifically what caused the error. I was adding instrumentation to the code and would get output from puts before that line but not after. From there I installed inspec and it worked.

from kitchen-docker.

olhado avatar olhado commented on June 25, 2024

So is the workaround still to add the kitchen-inspec gem?

from kitchen-docker.

RulerOf avatar RulerOf commented on June 25, 2024

@olhado I would suggest trying that, yes

from kitchen-docker.

olhado avatar olhado commented on June 25, 2024

That seemed to work!

from kitchen-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.