lib/kitchen/driver/docker.rb in kitchen-docker-0.1.3 vs lib/kitchen/driver/docker.rb in kitchen-docker-0.2.0

- old
+ new

@@ -91,11 +91,13 @@ [from, platform, base].join("\n") end def parse_image_id(output) output.each_line do |line| - return line.split(/\s+/).last if line =~ /image id/i + if line =~ /image id|build successful|successfully built/i + return line.split(/\s+/).last + end end raise ActionFailed, 'Could not parse Docker build output for image ID' end @@ -124,12 +126,13 @@ parse_container_id(output) end def parse_container_ip(output) begin - info = JSON.parse(output) - info['NetworkSettings']['IpAddress'] + info = Array(JSON.parse(output)).first + settings = info['NetworkSettings'] + settings['IpAddress'] || settings['IPAddress'] rescue raise ActionFailed, 'Could not parse Docker inspect output for container IP address' end end @@ -145,9 +148,10 @@ ssh(ssh_args, 'echo "127.0.0.1 `hostname`" | sudo tee -a /etc/hosts') end def rm_container(state) container_id = state[:container_id] + run_command("docker stop #{container_id}") run_command("docker rm #{container_id}") end def rm_image(state) image_id = state[:image_id]