[FACT-96] Deprecate 'facter --puppet' Created: 2013/11/20  Updated: 2017/01/26  Resolved: 2015/05/20

Status: Closed
Project: Facter
Component/s: None
Affects Version/s: None
Fix Version/s: FACT 2.4.4

Type: Task Priority: Normal
Reporter: Kylo Ginsberg Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks FACT-1111 Restore 'facter --puppet' Closed
Relates
relates to PUP-3610 external facts copied over via plugin... Closed
relates to PUP-6040 "puppet facts" outputs indirector obj... Ready for Engineering
relates to FACT-696 facts.d module "external" facts get p... Closed
relates to FACT-780 Running 'facter --puppet' produced no... Closed
relates to FACT-1283 facter --puppet doesn't load plugin s... Closed
Template:
Story Points: 1
Sprint: Client 2015-05-27
Release Notes: New Feature

 Description   

facter --puppet introduces a circular dependency, since puppet already depends on facter. So let's deprecate facter --puppet and document/improve puppet facts find as a replacement.

This is used in the pe_mcollective plugin so that would need an update:
https://github.com/puppetlabs/puppetlabs-pe_mcollective/blob/master/templates/refresh-mcollective-metadata



 Comments   
Comment by Nicholas Fagerlund [ 2015/01/22 ]

Oh man, puppet facts find.

I'd like to start a discussion here: if we're going to push users from something relatively easy and constrained to something else, I believe the something else shouldn't be an indirector face, because they're whatever the opposite is of easy, constrained, and fit-for-particular-purpose. I really hate those auto-generated find/destroy/etc. interfaces, and do not get me started on --terminus.

Let's decide what the use cases are for getting facts via Puppet's CLI, intentionally design a nice bare-bones interface for doing those things, and replace the current puppet facts. If we can.

Comment by Kylo Ginsberg [ 2015/01/22 ]

Nicholas Fagerlund believe me, I hate the auto-generated cruft in faces as well

However, in puppet 4, just puppet facts works as you'd expect, thanks to some faces cleanup from Erik Dalen.

(In puppet 3 you'd still need to say puppet facts find x (where the x is ignored but necessary).)

Since removing facter --puppet wouldn't come til facter 3, I think this is okay, but what are your thoughts?

Comment by Nicholas Fagerlund [ 2015/01/22 ]

Kylo Ginsberg Ah cool. I agree that's okay.

So the target is 3.0 for a removal, and... either 2.x for a deprecation, or a docs-only deprecation?

Comment by Kylo Ginsberg [ 2015/01/22 ]

either 2.x for a deprecation, or a docs-only deprecation?

Good question. I lean toward a visible deprecation warning because there are a fair number of users who may be using facter --puppet on the command line and it'd be nice to give them a heads up. On the other hand there may be scripted uses where a warning message might become spammy, so I could easily be persuaded to make it docs-only deprecation.

Comment by Kylo Ginsberg [ 2015/02/05 ]

A couple comments from an IRC discussion that are omissions in 'puppet facts':

  • it doesn't pretty-print facts, though there was an idea for that
  • it doesn't allow printing individual facts (or a CLI-specified list of facts)

[16:06:03]  <Elyscape>	you need to do "puppet facts find dummyname", it gives a completely different output format, and you can't specify individual facts to look up
[16:06:14]  <Elyscape>	e.g. there is no equivalent of "facter -p mycustomfact"
[16:06:37]  <kylo>	in puppet 4, you can just say 'puppet facts'
[16:06:42]  <Elyscape>	ooh, nice
[16:06:49]  <kylo>	that dummyname thing is/was super irritating
[16:07:30]  <kylo>	i thought you could specify output format? but don't remember, maybe just yaml
[16:07:32]  <rnelson0>	wow puppet facts find is horrid
[16:08:17]  <rnelson0>	yaml or json
[16:08:24]  <Elyscape>	you can.  --render-as yaml
[16:08:26]  <Elyscape>	json is the default
[16:08:31]  <Elyscape>	but it's still a different format what facter prints
[16:08:37]  <rnelson0>	RENDERING ISSUES: Facts cannot currently be rendered as a string
[16:09:14]  <Elyscape>	also string calls #to_s, giving you (for example): #<Puppet::Node::Facts:0x000000042dff60>
[16:09:35]  <rnelson0>	facter -p osfamily == puppet facts find puppet.nelson.va --render-as yaml | grep osfamily | awk '{print $2}'
[16:10:08]  <Elyscape>	yeahhhh, that latter stuff shouldn't be necessary
[16:16:37]  <kylo>	ah okay so another thing
[16:17:16]  <kylo>	with so many facts being structured now, we chatted in triage the other day about dropping either all or all-but-a-few of the legacy flat facts
[16:17:19]  <kylo>	in facter 3
[16:17:45]  <kylo>	so the plantext output for facter wouldn't be so useful for structured facts
[16:17:49]  <kylo>	plaintext
[16:19:34]  <Elyscape>	that's fair
[16:19:59]  <Elyscape>	still ,there should be a way to get a single fact from "puppet facts"
[16:20:35]  <Elyscape>	or a list. apparently you can do "facter osfamily virtual" and it'll print both
[16:20:36]  <kylo>	and cfacter lets you do things like
[16:20:40]  <kylo>	https://gist.github.com/kylog/eb2c1db4770176810c52
[16:20:57]  <kylo>	the dot notation is just an idea for now, but could be nice
[16:21:09]  <Elyscape>	indeed
[16:26:30]  <Elyscape>	actually, one thing that could be done would be to make "--render-as s" act like the current facter output, and that could be done by implementing the to_s method on Puppet::Node::Facts

Comment by Kylo Ginsberg [ 2015/03/31 ]

Nicholas Fagerlund do we have a docs-only deprecation in facter 2 docs?

Comment by Josh Cooper [ 2015/03/31 ]

it doesn't pretty-print facts, though there was an idea for that

puppet facts find will now pretty print (see PUP-3706).

Comment by Nicholas Fagerlund [ 2015/03/31 ]

Kylo Ginsberg ...no, I don't think so. Come to think of it, I don't think we document the command line tool at all on the website. (!?!?!!?)

But! If you run facter --help on the cli, you'll get help text. And that help text lists the --puppet option WITHOUT any mention of its deprecation. That documentation lives in lib/facter/application.rb.

Comment by Kylo Ginsberg [ 2015/04/03 ]

Ah Nicholas Fagerlund, I like that idea. We can add the deprecation message to the help output without emitting it on every actual invocation. Sold!

And I'm going to target this at 2.4.4 so we get it into a facter 2.x release.

Comment by Kylo Ginsberg [ 2015/05/15 ]

For release notes, I'm calling this a "New Feature" but I'm fine if you decide one of the other categories is a better fit.

Regardless, it will be good to highlight this in release notes to elevate visibility.

Comment by Kurt Wall [ 2015/05/18 ]

Validated in 2.x at SHA=34bab69. facter -h and facter --help emits a deprecation notice, but facter --puppet does not:

$ be facter --help | egrep -- "--puppet"
    facter [-h|--help] [-t|--timing] [-d|--debug] [-p|--puppet] [-v|--version]
    -p, --puppet                     (Deprecated: use `puppet facts` instead) Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.
 
$ be facter --puppet operatingsystem
Darwin

Comment by Jo Rhett [ 2015/05/21 ]

So there's a significant loss of functionality here. I see no method of retrieving a single value, which is very highly used within external scripts which make use of puppet plugin-synced facts.

$ facter system_uptime
{"seconds"=>532, "hours"=>0, "days"=>0, "uptime"=>"0:08 hours"}

Comment by Kylo Ginsberg [ 2015/05/22 ]

Jo Rhett I didn't connect your comment to your example. Specifically, system_uptime is a built-in fact, not a plugin-synced fact. Are you asking about the ability to get an individual element of a structured fact (like system_uptime) from the command-line?

If so, with facter 3, you can use a dotted syntax on the command line, e.g.

$ ./bin/facter system_uptime
{
  days => 27,
  hours => 669,
  seconds => 2410743,
  uptime => "27 days"
}
$ ./bin/facter system_uptime.days
27

Comment by Adam Buxton [ 2015/11/06 ]

Hi there as been no update on this in some time but Nicolas Corrarello from the TSE team as a customer query about deprecation warning, can we clarify what if anything is being deprecated and if `facter -p factname` is being deprecated will `puppet facts factname` be supported!

Comment by Kylo Ginsberg [ 2015/11/06 ]

Adam Buxton we reversed course on the deprecation, at least until puppet facts offers full parity.

See note here: https://docs.puppetlabs.com/facter/3.0/release_notes.html#facter--p-restored

Generated at Sat Dec 14 17:58:24 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.