[PUP-578] (PR) Support pluginsync of external facts from modules Created: 2013/10/18  Updated: 2019/04/04  Resolved: 2013/11/15

Status: Closed
Project: Puppet
Component/s: Networking
Affects Version/s: None
Fix Version/s: PUP 3.4.0

Type: Improvement Priority: Normal
Reporter: Andrew Parker Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
is blocked by PUP-3610 external facts copied over via plugin... Closed
is blocked by FACT-85 Pull Request (550): (#9546) Do not ex... Closed
Relates
Template:
Story Points: 1
Sprint: Week 2013-10-23 to 2013-10-30, Week 2013-10-30 to 2013-11-06, Week 2013-11-06 to 2013-11-13, Week 2013-11-13 to 2013-11-22

 Comments   
Comment by Nicholas Fagerlund [ 2013/10/30 ]

Gentle reminder to make sure there's a write-up of the behavior as-implemented, and to drop it in pre-docs.

Comment by Kurt Wall [ 2013/11/04 ]

Andrew Parker Is this documented per Nicholas Fagerlund's comment?

Comment by Kurt Wall [ 2013/11/08 ]

Andrew and I paired on this. The feature works as designed. Unfortunately, the module tool strips the execute bit off of an external fact generated from a shell script, causing that fact to fail.

Repro:

# Custom fact in module shell script (modulepath/ext/facts.d/kurt.sh)
#!/bin/bash
echo "key_1=fact_1"
echo "key_2=fact_2"
 
# module init.pp (modulepath/ext/manifests/init.pp)
class ext {
  notify {
    "key_1": message => "$key_1";
    "key_2": message => "$key_2";
  }
}
 
# generate and install the module
$ puppet module generate kurt-ext
$ mkdir kurt-ext/facts.d
$ cd kurt-ext/facts.d
# put shell script here
chmod +755 kurt.sh
$ ls -l kurt.sh
-rwxrwxr-x. 1 kurt kurt 53 Nov  8 12:04 kurt.sh
cd ../manifests
# put the init.pp script here
$ cd ..
$ puppet apply --modulepath ~ tests/init.pp
Notice: Compiled catalog for centos6-master.localdomain in environment production in 0.02 seconds
Notice: fact_2
Notice: /Stage[main]/Ext/Notify[key_2]/message: defined 'message' as 'fact_2'
Notice: fact_1
Notice: /Stage[main]/Ext/Notify[key_1]/message: defined 'message' as 'fact_1'
Notice: Finished catalog run in 0.04 seconds
 
# Build and install module
$ puppet module build
Notice: Building /home/kurt/ext for release
Module built: /home/kurt/ext/pkg/kurt-ext-0.1.0.tar.gz
$ su -
# puppet module install --ignore-dependencies ~kurt/ext/pkg/kurt-ext-0.1.0.tar.gz
Notice: Preparing to install into /etc/puppet/modules ...
Notice: Installing -- do not interrupt ...
/etc/puppet/modules
└── kurt-ext (v0.1.0)
# puppet agent -t
Info: Retrieving pluginfacts
Notice: /File[/var/lib/puppet/facts.d/kurt.sh]/ensure: defined content as '{md5}52a81929a8430a7c7fd707554a46122c'
Info: Retrieving plugin
Info: Loading external facts from /etc/puppet/modules/ext/facts.d
Info: Caching catalog for centos6-master.localdomain
Info: Applying configuration version '1383942330'
Notice: Finished catalog run in 0.02 seconds
# ls -l /etc/puppet/modules/ext/facts.d/kurt.sh 
-rw-r--r--. 1 root root 53 Nov  8 12:40 /etc/puppet/modules/ext/facts.d/kurt.sh
# echo "include ext" >> /etc/puppet/manifests/site.pp
# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading external facts from /etc/puppet/modules/ext/facts.d
Info: Caching catalog for centos6-master.localdomain
Info: Applying configuration version '1383943553'
Notice: 
Notice: /Stage[main]/Ext/Notify[key_2]/message: defined 'message' as ''
Notice: 
Notice: /Stage[main]/Ext/Notify[key_1]/message: defined 'message' as ''
Notice: Finished catalog run in 0.02 seconds
# chmod +x /etc/puppet/modules/ext/facts.d/kurt.sh
# puppet agent -t
Info: Retrieving pluginfacts
Notice: /File[/var/lib/puppet/facts.d/kurt.sh]/mode: mode changed '0644' to '0755'
Info: Retrieving plugin
Info: Loading external facts from /etc/puppet/modules/ext/facts.d
Info: Caching catalog for centos6-master.localdomain
Info: Applying configuration version '1383943553'
Notice: fact_2
Notice: /Stage[main]/Ext/Notify[key_2]/message: defined 'message' as 'fact_2'
Notice: fact_1
Notice: /Stage[main]/Ext/Notify[key_1]/message: defined 'message' as 'fact_1'
Notice: Finished catalog run in 0.02 seconds

Comment by Kylo Ginsberg [ 2013/11/10 ]

Nicholas Fagerlund my bad, it slipped my mind, but I just added a note to pre-docs. Let me know if you need more details.

Comment by Andrew Parker [ 2013/11/11 ]

Merged fixed PMT in https://github.com/puppetlabs/puppet/commit/e84ddb3530982698a95ce59d25826a1b58780a2f

Comment by Andrew Parker [ 2013/11/11 ]

I verified the PMT fix by following the same steps that Kurt and I had done before. They seemed to work this time

Comment by Kurt Wall [ 2013/11/14 ]

Verified with

  • pl-facter-7f31009fe9107f6fddd2ac87c5dbc202802c7972
  • pl-puppet-11ef14ce1bbbed1bc03f2a5ffee0fc803e51b0bc
Comment by Kurt Wall [ 2013/11/15 ]

Verified with
pl-facter-7f31009fe9107f6fddd2ac87c5dbc202802c7972
pl-puppet-11ef14ce1bbbed1bc03f2a5ffee0fc803e51b0bc

Generated at Sat Feb 22 15:01:52 PST 2020 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.