Class: Puppet::Node::Facts::PuppetdbApply

Inherits:
Puppetdb
  • Object
show all
Defined in:
lib/puppet/indirector/facts/puppetdb_apply.rb

Overview

This class provides an alternative implementation of the Facts::Puppetdb terminus that better suits execution via ‘puppet apply`.

This terminus is designed to be used as a cache terminus, to ensure that facts are stored in PuppetDB. It does not act as a real cache itself however, it tells Puppet to fallback to the ‘terminus` instead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dbstored=(value) ⇒ Object (writeonly)

Sets the attribute dbstored

Parameters:

  • value

    the value to set the attribute dbstored to.



10
11
12
# File 'lib/puppet/indirector/facts/puppetdb_apply.rb', line 10

def dbstored=(value)
  @dbstored = value
end

Instance Method Details

#find(args) ⇒ Object

By returning nil, we force puppet to use the real terminus.



22
23
24
# File 'lib/puppet/indirector/facts/puppetdb_apply.rb', line 22

def find(args)
  nil
end

#save(args) ⇒ Object

Here we override the normal save, only saving the first time, as a ‘save` can be called multiple times in a puppet run.



14
15
16
17
18
19
# File 'lib/puppet/indirector/facts/puppetdb_apply.rb', line 14

def save(args)
  unless @dbstored
    @dbstored = true
    super(args)
  end
end