Age | Commit message (Collapse) | Author |
|
This reverts commit d6d23b495cda0e154b4e73982acc43e586564c0e.
This backwards-compatible additional functionality is targeted at the
next minor release. There are already backwards-incompatible changes in
the master branch so we need to establish a new minor branch.
|
|
This reverts commit 74e6411157b8df1af9a24c17971e3236f3096529, reversing
changes made to 417d219aa6e42f2a16af42c98aa063fc1d9d2ecd.
Here's why:
Actually... I just screwed this up.
I merged this new fact into 2.4.x but it's not fixing any bug. It's adding a
new fact, so this should go into master and we should release 2.5 since this is
new, backwards-compatible functionality.
|
|
Without this patch the pe_major_version, pe_minor_version, and
pe_patch_version facts directly depend on the pe_version fact in a
manner that calls split directly on the return value.
This is a problem because Fact values are not always guaranteed to
return strings, or objects that respond to split. This patch is a
defensive measure to ensure we're always calling the split method on a
string object.
If the Fact returns nil, this will be converted to an empty string
responding to split.
|
|
As many PE modules have PE specific functionality, but are deployed to all
nodes, including FOSS nodes, it is valuable to be able to selectively enable
those PE specific functions. These facts allow modules to use the is_pe fact to
determine whether the module should be used or not. The facts include is_pe,
pe_version, pe_major_version, pe_minor_version, and pe_patch_version. For PE
2.6.0 those facts would have values true, 2.6.0, 2, 6, and 0, respectively.
|
|
Since facts_dot_d will eventually be removed and replaced by
external facts, warn users who are using a ttl on their external
facts that this feature will not be in Facter external facts.
Provide a link to a page explaining how to cache fact values
without the ttl functionality.
|
|
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.
|