Age | Commit message (Collapse) | Author |
|
Puppet apply does not add the stdlib lib directory to the $LOAD_PATH.
This is a problem because the puppet_vardir fact requires the
puppet_settings library to be available for the `with_puppet` utility
method.
Without this patch, puppet apply will result in the following error:
$ puppet apply --modulepath=/vagrant/modules -e 'notice $puppet_vardir'
warning: Could not load fact file stdlib/lib/facter/puppet_vardir.rb: no such file to load -- facter/util/puppet_settings
notice: Scope(Class[main]):
notice: Finished catalog run in 0.01 seconds
With this patch applied, puppet apply works as expected:
$ puppet apply --modulepath=/vagrant/modules.pe -e 'notice $puppet_vardir'
notice: Scope(Class[main]): /Users/jeff/.puppet/var
notice: Finished catalog run in 0.01 seconds
This patch defensively tries to load facter/util/puppet_settings. If it cannot
load it, it falls back to trying to explicitly locate and load the library.
Once puppet is fixed such that a modules lib directory is truly in the
$LOAD_PATH, the fall back implementation will no longer be exercised since the
LoadError should not be raised.
|
|
jeffmccune/ticket/2.3.x/12357_add_puppet_settings_facts
(#12357) Make facter_dot_d look in Puppet[:confdir]/facts.d
|
|
On Windows, we have no folders that match up to the default set of
directories the facter_dot_d fact looks in by default. This is a
problem because the Puppet Enterprise installer writes out the following
facts by default, and our modules require them to be present:
% cat /etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt
fact_stomp_port=61613
fact_stomp_server=puppetmaster
fact_is_puppetagent=true
fact_is_puppetmaster=true
fact_is_puppetconsole=true
On windows, the Puppet confdir is quite variable. On 2003 systems we
default to the All Users application data directory. On 2008 systems we
default to the ProgramData directory. The actual configuration
directory varies depending on the Puppet or Puppet Enterprise branding.
In order to simplify all of this variable behavior, this patch fixes the
problem by automatically looking for facts in
`%COMMON_APPDATA%/PuppetLabs/facter/facts.d`
This patch paves the way for the MSI installer to use an IniFile element
to write custom facts during installation.
|
|
Without this patch the PE modules don't have a way to identify a
filesystem path where it's OK to place variable data related to managing
the target node. This is a problem when a module like pe_compliance
needs to write a wrapper script to the node's filesystem.
This patch addresses the problem by exposing the node's Puppet[:vardir]
setting as a Facter fact.
This fact value will be set to `nil` if Puppet is not loaded into
memory. If Puppet is loaded, e.g. using `facter --puppet` or using
`puppet agent` or `puppet apply` then the fact will automatically set
the value to Puppet[:vardir]
The value of this setting is subject to Puppet's run_mode.
This patch implements a new utility method in the standard library
module named `Facter::Util::PuppetSettings.with_puppet`. The method
accepts a block and will only invoke the block if the Puppet library is
loaded into the Ruby process. If Puppet is not loaded, the method
always returns nil. This makes it easy to define Facter facts that only
give values if Puppet is loaded in memory.
|
|
Without this patch the root_home fact fails on windows. This patch
fixes the problem by only calling methods on the object returned by the
`getent passwd root` command if the object evaluates to true.
Because there is no root account on Windows the code block simply
returns `nil` which makes the Facter fact undefined on Windows
platforms.
The root cause of the failure is that we always expected the command to
succeed and return something useful, and it may not on all supported
platforms.
|
|
* 2.2.x:
(#12377) Avoid infinite loop when retrying require json
|
|
* 2.1.x:
(#12377) Avoid infinite loop when retrying require json
|
|
Without this patch an infinite loop will be entered if the json and
rubygems libraries are not available.
This patch fixes the problem by retrying the `require 'json'` only if
rubygems was successfully loaded for the first time. Subsequent
attempts to load rubygems will cause the LoadError exception from a
missing json library to be re-raised.
Thanks to Krzysztof Wilczynski for pointing out this issue.
|
|
This is causing a little confusion, so make the comment match
the behaviour.
|
|
Without this patch applied, the stdlib module does not provide a
root_home fact. This fact is necessary to easily determine the root
account home directory on platforms Puppet is supported on.
The major variations this fact address are:
---
solaris: /
linux: /root
macosx: /var/root
Spec tests using rspec have been provided as well to cover these three
general cases. Windows tests are marked as pending.
|
|
Based on feedback from Luke, the facts.d directory should at least match
the directory that will be used by Facter 2.0.
Reading #2157 I believe the Facter 2.0 facts.d feature is reasonably API
compatible with this custom fact from R.I. so I'm comfortable using the
same filesystem path.
Change in behavior: Now look for facts in:
* /etc/facter/facts.d
* /etc/puppetlabs/facter/facts.d
|
|
This fact is a direct copy of R.I.'s work at
https://github.com/ripienaar/facter-facts
This is necessary plumbing to allow the installer to write a simple text
file based on the role the node is receiving. For example:
$ cat /etc/puppetlabs/facts.d/puppet_enterprise_mcollective.txt
fact_stomp_port=61613
fact_stomp_server=puppetmaster
fact_is_puppetagent=true
fact_is_puppetmaster=true
The mcollectivepe module relies on these facts being set and we need a
persistent place to write them during the interview process and later
read them when puppet agent runs to configure MCollective on the agent
systems.
Since stdlib is a public module, both /etc/facts.d and
/etc/puppetlabs/facts.d are scanned for static facts.
|