The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:
apply and pluginsync problems
|Assignee:||Ken Barber||% Done:|
|Keywords:||Affected PuppetDB version:||0.9.0|
Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com
I am using puppet apply without a master and have puppetdb setup.
I am seeing that my local machine custom facts are not used correctly or stored to puppetdb:
With ‘puppet apply —pluginsync’ and storeconfigs=false I see:
- my custom fact from the module dir is loaded
- lines are logged saying its loading my custom facts
- any custom facts from from /var/lib/puppet/lib/facter get loaded
- lines are logged saying those are loading
- my custom fact from the module dir is loaded again
- my configuration gets applied
With puppetdb-terminus-0.9.1-2.el6.noarch, storedconfigs=true the following happens:
info: Caching node for devco.net info: Caching catalog for devco.net info: 'replace catalog' command for devco.net submitted to PuppetDB with UUID c77f592f-c2ef-49f9-92f2-9fb6e7428939 notice: ********************
The last line is a Puppet.notice() I added to my custom fact in /var/lib/puppet/lib/facter while debug I added to the fact in my module dir never gets run.
When running with —debug and storedconfigs enabled:
debug: Configuring PuppetDB terminuses with config file /etc/puppet/puppetdb.conf debug: Using cached facts for devco.net info: Caching node for devco.net
The second line makes me think its treating the puppetdb terminus as the cache and so i get last-saved facts as current facts
- The most glaring thing is that the fact gets loaded after the catalog is compiled and cached, so my fact never gets sent to puppetdb
- for normal facter supplied facts a change to the fact takes multiple runs to get to influence my manifest
- I lost the ability to use facts in the moduledir via pluginsync something the normal facter terminus is doing for me today
- The logging is less awesome
The end result is that it seems my facts are now effectively readonly changes to a local fact never gets saved to puppetdb and those local facts dont impact the compile, it always use the cache found in puppetdb. I have no idea how these nodes ever even got into PuppetDB given this, a new node I bootstrapped is impossible to use since my catalogs depend on the custom facts being here and they can only be here if a node has previously sent them to puppetdb
#3 Updated by Ken Barber almost 3 years ago
A workaround for now could be something like the following.
Create a file
puppetdb_apply.rb next to the existing facts terminus (for example:
require 'puppet/indirector/facts/puppetdb' class Puppet::Node::Facts::PuppetdbApply < Puppet::Node::Facts::Puppetdb def find(request) nil end end
/etc/puppet/routes.yaml like below:
apply: facts: terminus: facter cache: puppetdb_apply
This work-around will treat PuppetDB as a cache, but not as a source of truth for facts – the overriding of
#find will force Puppet to skip over that ‘cache’ and use the ‘terminus’ instead, which is
facter. However, as ‘puppetdb_apply’ is the cache, later on a
#save should occur – saving the facts to PuppetDB as desired.
The problem with this solution today, is that it will send the facts to puppetdb twice, which is less than desirable.
#9 Updated by Ken Barber almost 3 years ago
- Status changed from In Topic Branch Pending Review to Merged - Pending Release
- Affected PuppetDB version changed from 1.2.0 to 0.9.0