changeset 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 4519b727cc4c
children 6467e768e353
files modules/website/lib/puppet/parser/functions/hash_to_csp.rb
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/website/lib/puppet/parser/functions/hash_to_csp.rb	Fri Dec 20 09:41:34 2019 +0000
@@ -0,0 +1,8 @@
+module Puppet::Parser::Functions
+	newfunction(:hash_to_csp, :type => :rvalue) do |args|
+		csp_defaults = args[0]
+		csp_overrides = args[1]
+		csp_combined = csp_defaults.merge(csp_overrides == "" ? {} : csp_overrides)
+		csp_string = csp_combined.map { |index, value| "#{index} #{value}" }.join ("; ")
+	end
+end
\ No newline at end of file