Puppet Function: helm_ls_flags

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

Overview

helm_ls_flags()Any

Transforms a hash into a string of helm ls flags

Returns:

  • (Any)


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

newfunction(:helm_ls_flags, :type => :rvalue) do |args|
  opts = args[0] || {}
  flags = []
  flags << 'ls' if opts['ls']
  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 << "--tiller-namespace '#{opts['tiller_namespace']}'" if opts['tiller_namespace'] && opts['tiller_namespace'].to_s != 'undef'
  flags << '--short' if opts['short']
  flags << '--tls' if opts['tls']
  flags << "--tls-ca-cert '#{opts['tls_ca_cert']}'" if opts['tls_ca_cert'] && opts['tls_ca_cert'].to_s != 'undef'
  flags << "--tls-cert '#{opts['tls_cert']}'" if opts['tls_cert'] && opts['tls_cert'].to_s != 'undef'
  flags << "--tls-key '#{opts['tls_key']}'" if opts['tls_key'] && opts['tls_key'].to_s != 'undef'
  flags << '--tls-verify' if opts['tls_verify']
  flags.flatten.join(' ')
end