Ask Your Question

overwrite fact osfamily

asked 2016-09-22 07:06:43 -0500

Johannes gravatar image
Puppet Agent Version: 4.6.2
Facter Version 3.4.1 (commit d0f32490f41ca12722c13e4c48d4572ae4f9bfdc)
puppetserver version: 2.6.0
Server Linux:
 * Linux server-hostname 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux
 * Debian GNU/Linux 8 (jessie)
 * facter -p osfamily: Debian
Client Linux:
 * Linux client-hostname 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux
 * Devuan GNU/Linux 1 (jessie)
 * facter -p osfamily: Linux

Problem: devuan shown as osfamily linux, instead of debian

Trying to resolve with facter overwrite

I wrote a Module with an customized fact in

user@client: $module/osfamily/lib/facter/osfamily.rb

Facter.add(:osfamily) do
  has_weight 100
  setcode 'debian'

but the debug (facter -p --debug) output exits with:

INFO  puppetlabs.facter - loading custom facts from /opt/puppetlabs/puppet/cache/lib/facter/osfamily.rb.
DEBUG puppetlabs.facter - fact "osfamily" resolved to null and the existing value of "Linux" will be removed.

Question is there a way to tell puppet, that this new distribution is a member of the Debian os family?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-22 13:33:17 -0500

lupin gravatar image

updated 2016-09-22 23:58:14 -0500

Is that your actual custom facts code? It's has a missing end keyword.

Facter.add(:osfamily) do
  has_weight 100
  setcode do
edit flag offensive delete link more



amazing. Sitting here hours and hours and then something little like this ends it all. Thank you lupin! btw, it has to be `setcode do`

Johannes gravatar imageJohannes ( 2016-09-22 14:01:35 -0500 )edit

it could also be setcode { 'debian'} (do ... end and { ... } are both the same in ruby)

DarylW gravatar imageDarylW ( 2016-09-22 23:35:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-09-22 07:06:43 -0500

Seen: 43 times

Last updated: Sep 22 '16