freighter 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70c6f6f59c11d33c9a2b6c2deea4e0cc53baccef
4
- data.tar.gz: a8e612fa7748bbbc9e68f9071a5e58a5a9974a52
3
+ metadata.gz: 9739746b3edb3b6a5501f9a06527001ba44bde9a
4
+ data.tar.gz: 2286c47c829338ab1517f253d91e708015e054ae
5
5
  SHA512:
6
- metadata.gz: ee8b45ac9114b3f277263c5ebfb9f315c535e4e5edcf2192a6bda2c2644ba832071e9591c4a96ac5f945fb490442d7e458c21d9ea1648b89dd22a0ac527ea195
7
- data.tar.gz: 8613d3b488128480c8a89b376cbd4722abb5eaa9ada2530202d5c0419d871542698a4d685b7245e2c044ea1df4c2a7e81b7bbc55c66bda6410c61302d39bae92
6
+ metadata.gz: 346ef0d893e55776c1b350ea8365a7111c1cd04c51de5e4581eb27fd298d60780cba18fd2a2d4ac2af5a80a3a4828cb2642a5ff64f636c1a11a170c4044ccdb7
7
+ data.tar.gz: 63d2046ad8739b5bf6d3bffb2cfbe24226c5b3dcf80c342ebb6370787da1ca8e72e8c8297b5eb09e54de852a8ceb65df2055c51618615510ecfab98adce2ffdb
@@ -69,10 +69,22 @@ module Freighter
69
69
 
70
70
  # determine if a the latest version of the image is currently running
71
71
  matching_containers = containers_matching_port_map(Docker::Container.all, image['containers'].map { |c| c['port_mapping'] })
72
- if image_ids.member?(pull_response.id) && !matching_containers.empty?
72
+
73
+ # stop previous container and start up a new container with the latest image
74
+ stopped_containers = []
75
+ current_running_containers = []
76
+ matching_containers.each do |container|
77
+ if pull_response.id =~ /^#{container.info['Image']}/
78
+ current_running_containers << container
79
+ else
80
+ Docker::Container.get(container.id).stop
81
+ stopped_containers << container
82
+ end
83
+ end
84
+ if !current_running_containers.empty? and stopped_containers.empty?
73
85
  logger.info msg["Container already running with the latest image: #{pull_response.id}"]
74
86
  else
75
- # stop previous container and start up a new container with the latest image
87
+ logger.info msg["Stopped containers: #{stopped_containers.map(&:info).map(&:to_json)}"]
76
88
  results = update_containers matching_containers, image
77
89
  logger.info msg["Finished:"]
78
90
  logger.info msg[" started: #{results[:started]}"]
@@ -1,3 +1,3 @@
1
1
  module Freighter
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean McCleary