From 8fae2aad9892655ffaabdefb80ee64c89794d4e9 Mon Sep 17 00:00:00 2001 From: david22swan Date: Thu, 1 Dec 2022 14:03:35 +0000 Subject: [PATCH] (CONT-24) docker_stack always redoploying Implementation of fix suggested by @grzleadams in the Github issue #848. --- lib/puppet/provider/docker_compose/ruby.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/docker_compose/ruby.rb b/lib/puppet/provider/docker_compose/ruby.rb index 55a478c5..03fd7871 100644 --- a/lib/puppet/provider/docker_compose/ruby.rb +++ b/lib/puppet/provider/docker_compose/ruby.rb @@ -30,11 +30,10 @@ def exists? args = [compose_files, '-p', name, 'config'].insert(3, resource[:options]).compact compose_output = YAML.safe_load(execute([command(:dockercompose)] + args, combine: false), [Symbol]) - # rubocop:disable Style/StringLiterals containers = docker([ 'ps', '--format', - "{{.Label \"com.docker.compose.service\"}}-{{.Image}}", + "'{{.Label \"com.docker.compose.service\"}}-{{.Image}}'", '--filter', "label=com.docker.compose.project=#{name}", ]).split("\n") @@ -49,7 +48,7 @@ def exists? counts = Hash[*compose_services.each.map { |key, array| image = (array['image']) ? array['image'] : get_image(key, compose_services) Puppet.info("Checking for compose service #{key} #{image}") - [key, compose_containers.count("#{key}-#{image}")] + [key, compose_containers.count("'#{key}-#{image}'")] }.flatten] # No containers found for the project