Skip to content

Instantly share code, notes, and snippets.

@natemccurdy
Created October 18, 2021 19:52
Show Gist options
  • Save natemccurdy/2373abd3c310f10b07265d832c44128d to your computer and use it in GitHub Desktop.
Save natemccurdy/2373abd3c310f10b07265d832c44128d to your computer and use it in GitHub Desktop.
A write_only_json catalog cache terminus for Puppetserver
require 'puppet/indirector/catalog/json'
# This is a write-only catalog cache terminus for saving compiled catalogs to disk as JSON.
#
# It extends the built-in JSON catalog terminus:
# * https://github.com/puppetlabs/puppet/blob/6.19.1/lib/puppet/indirector/catalog/json.rb
# * https://github.com/puppetlabs/puppet/blob/6.19.1/lib/puppet/indirector/json.rb
#
class Puppet::Resource::Catalog::WriteOnlyJson < Puppet::Resource::Catalog::Json
desc 'A write-only terminus that stores catalogs as flat, serialized JSON files.'
# Overridden to always return nil. This is a write only terminus.
# By returning nil, cache lookups fail, and a new catalog will be compiled.
# @param [Object] request Ignored.
# @return Always returns nil
# @api public
def find(_request)
nil
end
# Overridden to always return nil. This is a write only terminus.
# By returning nil, cache lookups fail, and a new catalog will be compiled.
# @param [Object] request Ignored.
# @return Always returns nil
# @api public
def search(_request)
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment