Puppet Function: docker_stack_flags
- Defined in:
- lib/puppet/parser/functions/docker_stack_flags.rb
- Function type:
- Ruby 3.x API
Overview
Transforms a hash into a string of docker stack flags
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/puppet/parser/functions/docker_stack_flags.rb', line 9 newfunction(:docker_stack_flags, type: :rvalue) do |args| opts = args[0] || {} flags = [] flags << "--bundle-file '#{opts['bundle_file']}'" if opts['bundle_file'] && opts['bundle_file'].to_s != 'undef' if opts['compose_files'] && opts['compose_files'].to_s != 'undef' opts['compose_files'].each do |file| flags << "--compose-file '#{file}'" end end flags << "--resolve-image '#{opts['resolve_image']}'" if opts['resolve_image'] && opts['resolve_image'].to_s != 'undef' flags << '--prune' if opts['prune'] && opts['prune'].to_s != 'undef' flags << '--with-registry-auth' if opts['with_registry_auth'] && opts['with_registry_auth'].to_s != 'undef' flags.flatten.join(' ') end |