The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #15369

apply and pluginsync problems

Added by R.I. Pienaar almost 4 years ago. Updated over 2 years ago.

Status:ClosedStart date:07/04/2012
Priority:NormalDue date:
Assignee:Ken Barber% Done:

0%

Category:-
Target version:1.4.0
Keywords: Affected PuppetDB version:0.9.0
Branch:https://github.com/kbarber/puppetdb/tree/puppet_apply

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

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

So:

  • 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


Related issues

Related to Puppet - Bug #16781: It's not possible to configure Puppet apply to use Puppet... Investigating 10/04/2012

History

#1 Updated by R.I. Pienaar almost 4 years ago

  • Description updated (diff)

#2 Updated by Deepak Giridharagopal almost 4 years ago

  • Status changed from Unreviewed to Accepted

#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: /usr/lib/ruby/vendor_ruby/puppet/indirector/facts/puppetdb_apply.rb):

require 'puppet/indirector/facts/puppetdb'

class Puppet::Node::Facts::PuppetdbApply < Puppet::Node::Facts::Puppetdb
  def find(request)
    nil
  end
end

Setup your /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.

#4 Updated by Ken Barber almost 3 years ago

  • Assignee set to Ken Barber
  • Branch set to https://github.com/kbarber/puppetdb/tree/puppet_apply
  • Affected PuppetDB version set to 0.9.0

#5 Updated by Ken Barber almost 3 years ago

  • Status changed from Accepted to In Topic Branch Pending Review

#6 Updated by Deepak Giridharagopal almost 3 years ago

  • Target version set to 1.4.0

#7 Updated by Ken Barber almost 3 years ago

  • Target version deleted (1.4.0)
  • Affected PuppetDB version deleted (0.9.0)

#8 Updated by Ken Barber almost 3 years ago

  • Target version set to 1.4.0
  • Affected PuppetDB version set to 1.2.0

#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

#10 Updated by Ken Barber over 2 years ago

  • Status changed from Merged - Pending Release to Closed

Also available in: Atom PDF