lib/kitchen/driver/docker.rb in kitchen-docker-0.11.0 vs lib/kitchen/driver/docker.rb in kitchen-docker-0.12.0

- old
+ new

@@ -24,17 +24,20 @@ # Docker driver for Kitchen. # # @author Sean Porter <portertech@gmail.com> class Docker < Kitchen::Driver::SSHBase - default_config :username, 'kitchen' - default_config :password, 'kitchen' - default_config :require_chef_omnibus, true - default_config :remove_images, false - default_config :privileged, false - default_config :use_sudo, true + default_config :socket, nil + default_config :privileged, false + default_config :remove_images, false + default_config :username, 'kitchen' + default_config :password, 'kitchen' + default_config :use_sudo do |driver| + !driver.remote_socket? + end + default_config :image do |driver| driver.default_image end default_config :platform do |driver| @@ -70,17 +73,17 @@ if config[:remove_images] && state[:image_id] rm_image(state) end end + def remote_socket? + config[:socket] ? socket_uri.scheme == 'tcp' : false + end + protected def socket_uri URI.parse(config[:socket]) - end - - def remote_socket? - config[:socket] ? socket_uri.scheme == 'tcp' : false end def docker_command(cmd, options={}) docker = "docker" docker << " -H #{config[:socket]}" if config[:socket]