lib/kitchen/driver/docker.rb in kitchen-docker-0.7.1 vs lib/kitchen/driver/docker.rb in kitchen-docker-0.8.0.beta
- old
+ new
@@ -27,23 +27,36 @@
# Docker driver for Kitchen.
#
# @author Sean Porter <portertech@gmail.com>
class Docker < Kitchen::Driver::SSHBase
- default_config :image, 'base'
- default_config :platform, 'ubuntu'
default_config :port, '22'
default_config :username, 'kitchen'
default_config :password, 'kitchen'
default_config :require_chef_omnibus, true
default_config :remove_images, false
default_config :use_sudo, true
+ default_config :image do |driver|
+ driver.default_image
+ end
+ default_config :platform do |driver|
+ driver.default_platform
+ end
def verify_dependencies
run_command('docker > /dev/null', :quiet => true)
rescue
raise UserError,
'You must first install Docker http://www.docker.io/gettingstarted/'
+ end
+
+ def default_image
+ platform, release = instance.platform.name.split('-')
+ release ? [platform, release].join(':') : 'base'
+ end
+
+ def default_platform
+ instance.platform.name.split('-').first || 'ubuntu'
end
def create(state)
state[:image_id] = build_image(state) unless state[:image_id]
state[:container_id] = run_container(state) unless state[:container_id]