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 swarm init flags
7 8 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 7 newfunction(:docker_stack_flags, :type => :rvalue) do |args| opts = args[0] || {} flags = [] if opts['bundle_file'].to_s != 'undef' flags << "--bundle-file '#{opts['bundle_file']}'" end if opts['compose_file'].to_s != 'undef' flags << "--compose-file '#{opts['compose_file']}'" end if opts['prune'].to_s != 'undef' flags << "--prune '#{opts['prune']}'" end if opts['with_registry_auth'].to_s != 'undef' flags << "--with-registry-auth '#{opts['with_registry_auth']}'" end flags.flatten.join(' ') end |