Skip to content

Commit 74bb531

Browse files
(MODULES-11645) Ignore services with restart option as 'no' in exists? method
Services who have restart option set as 'no' are meant to be batch processing jobs which terminate once completed. Docker compose does not restart them, but in the exists? method, puppet looks for a running service. When it is unable to see a running service, it incorrectly assumes non-desired state and makes a corrective change. This commit rejects services with restart 'no' from the compose_services to mitigate this bug.
1 parent aded8fc commit 74bb531

File tree

1 file changed

+4
-0
lines changed
  • lib/puppet/provider/docker_compose

1 file changed

+4
-0
lines changed

lib/puppet/provider/docker_compose/ruby.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def exists?
4040

4141
compose_services = compose_output['services']
4242

43+
44+
# Remove services with restart: 'no' from the compose_services list as they are not expected to be running.
45+
compose_services.reject! { |_k, v| v['restart'] == 'no' }
46+
4347
return false if compose_services.count != compose_containers.uniq.count
4448

4549
counts = Hash[*compose_services.each.map { |key, array|

0 commit comments

Comments
 (0)