File tree Expand file tree Collapse file tree
lib/octocatalog-diff/catalog Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,13 +68,17 @@ def build(logger = Logger.new(StringIO.new))
6868
6969 # Returns a hash of parameters for each supported version of the Puppet Server Catalog API.
7070 # @return [Hash] Hash of parameters
71+ #
72+ # Note: The double escaping of the facts here is implemented to correspond to a long standing
73+ # bug in the Puppet code. See https://github.com/puppetlabs/puppet/pull/1818 and
74+ # https://docs.puppet.com/puppet/latest/http_api/http_catalog.html#parameters for explanation.
7175 def puppet_catalog_api
7276 {
7377 2 => {
7478 url : "https://#{ @options [ :puppet_master ] } /#{ @options [ :branch ] } /catalog/#{ @node } " ,
7579 parameters : {
7680 'facts_format' => 'pson' ,
77- 'facts' => @facts . fudge_timestamp . without ( 'trusted' ) . to_pson ,
81+ 'facts' => CGI . escape ( @facts . fudge_timestamp . without ( 'trusted' ) . to_pson ) ,
7882 'transaction_uuid' => SecureRandom . uuid
7983 }
8084 } ,
@@ -83,7 +87,7 @@ def puppet_catalog_api
8387 parameters : {
8488 'environment' => @options [ :branch ] ,
8589 'facts_format' => 'pson' ,
86- 'facts' => @facts . fudge_timestamp . without ( 'trusted' ) . to_pson ,
90+ 'facts' => CGI . escape ( @facts . fudge_timestamp . without ( 'trusted' ) . to_pson ) ,
8791 'transaction_uuid' => SecureRandom . uuid
8892 }
8993 }
You can’t perform that action at this time.
0 commit comments