Puppet Function: docker_exec_flags

Defined in:
lib/puppet/parser/functions/docker_exec_flags.rb
Function type:
Ruby 3.x API

Overview

docker_exec_flags()Any

Transforms a hash into a string of docker exec flags

Returns:

  • (Any)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/puppet/parser/functions/docker_exec_flags.rb', line 9

newfunction(:docker_exec_flags, type: :rvalue) do |args|
  opts = args[0] || {}
  flags = []

  flags << '--detach=true' if opts['detach']

  flags << '--interactive=true' if opts['interactive']

  flags << '--tty=true' if opts['tty']

  opts['env']&.each do |namevaluepair|
    flags << "--env #{namevaluepair}"
  end

  flags.flatten.join(' ')
end