Puppet Function: helm_repo_add_flags
- Defined in:
- lib/puppet/parser/functions/helm_repo_add_flags.rb
- Function type:
- Ruby 3.x API
Overview
Transforms a hash into a string of helm repo add flags
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/puppet/parser/functions/helm_repo_add_flags.rb', line 7 newfunction(:helm_repo_add_flags, :type => :rvalue) do |args| opts = args[0] || {} flags = [] flags << 'add' if opts['ensure'].to_s == 'present' flags << "--ca-file '#{opts['ca_file']}'" if opts['ca_file'] && opts['ca_file'].to_s != 'undef' flags << "--cert-file '#{opts['cert_file']}'" if opts['cert_file'] && opts['cert_file'].to_s != 'undef' flags << '--debug' if opts['debug'] flags << "--repo-name '#{opts['key_file']}'" if opts['key_file'] && opts['key_file'].to_s != 'undef' flags << '--no-update' if opts['no_update'] 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 << "'#{opts['repo_name']}'" if opts['repo_name'] && opts['repo_name'].to_s != 'undef' flags << "'#{opts['url']}'" if opts['url'] && opts['url'].to_s != 'undef' flags.flatten.join(' ') end |