Puppet Function: helm_create_flags

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

Overview

helm_create_flags()Any

Transforms a hash into a string of helm create flags

Returns:

  • (Any)


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/puppet/parser/functions/helm_create_flags.rb', line 7

newfunction(:helm_create_flags, :type => :rvalue) do |args|
  opts = args[0] || {}
  flags = []
  flags << '--debug' if opts['debug']
  flags << "--home '#{opts['home']}'" if opts['home'] && opts['home'].to_s != 'undef'
  flags << "--host '#{opts['host']}'" if opts['host'] && opts['host'].to_s != 'undef'
  flags << "--kube-context '#{opts['kube_context']}'" if opts['kube_context'] && opts['kube_context'].to_s != 'undef'
  flags << "--starter '#{opts['starter']}" if opts['starter'] && opts['starter'].to_s != 'undef'
  flags << "--tiller-namespace '#{opts['tiller_namespace']}'" if opts['tiller_namespace'] && opts['tiller_namespace'].to_s != 'undef'
  flags << "'#{opts['chart_path']}/#{opts['chart_name']}'" if opts['chart_path'] && opts['chart_path'].to_s != 'undef' && opts['chart_name'].to_s != 'undef'
  flags.flatten.join(' ')
end