annotate modules/website/lib/puppet/parser/functions/hash_to_csp.rb @ 237:1e65604c182a puppet-3.6

Add missing custom function Forgot to "hg add" it
author IBBoard <dev@ibboard.co.uk>
date Fri, 20 Dec 2019 09:41:34 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
237
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 module Puppet::Parser::Functions
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 newfunction(:hash_to_csp, :type => :rvalue) do |args|
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 csp_defaults = args[0]
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 csp_overrides = args[1]
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 csp_combined = csp_defaults.merge(csp_overrides == "" ? {} : csp_overrides)
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 csp_string = csp_combined.map { |index, value| "#{index} #{value}" }.join ("; ")
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 end
1e65604c182a Add missing custom function
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 end