Skip to content

Commit

Permalink
(CONT-24) docker_stack always redoploying
Browse files Browse the repository at this point in the history
Implementation of fix suggested by @grzleadams in the Github issue puppetlabs#848.
  • Loading branch information
david22swan committed Dec 1, 2022
1 parent 4c1dda4 commit 8fae2aa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/puppet/provider/docker_compose/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 8fae2aa

Please sign in to comment.