Jira (PUP-6040) "puppet facts" outputs indirector object instead of simple fact list

3 views
Skip to first unread message

Nicholas Fagerlund (JIRA)

unread,
Mar 10, 2016, 2:03:05 PM3/10/16
to puppe...@googlegroups.com
Nicholas Fagerlund moved an issue
 
Puppet / Bug PUP-6040
"puppet facts" outputs indirector object instead of simple fact list
Change By: Nicholas Fagerlund
Workflow: Documentation Scrum Team  Workflow
Issue Type: Improvement Bug
Key: DOCUMENT PUP - 514 6040
Project: Documentation Puppet
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc)
Atlassian logo

Josh Cooper (JIRA)

unread,
Jul 7, 2016, 2:42:04 AM7/7/16
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

The facter --puppet command introduces a cyclic dependency between puppet and facter. We want to deprecate/remove that option, and have puppet facts take it's place. However, puppet facts is not an exact replacement as this bug describes leading to FACT-1365.
That said I'm pretty sure this is a duplicate of an existing issue.

This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9)
Atlassian logo

Eric Sorenson (JIRA)

unread,
Jan 18, 2017, 2:55:05 PM1/18/17
to puppe...@googlegroups.com
Eric Sorenson updated an issue
 
Change By: Eric Sorenson
Team: Agent & Platform
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Eric Sorenson (JIRA)

unread,
Jan 18, 2017, 2:55:05 PM1/18/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Jan 26, 2017, 1:39:03 PM1/26/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
Jan 26, 2017, 1:39:04 PM1/26/17
to puppe...@googlegroups.com

Eric Sorenson (JIRA)

unread,
Jan 29, 2017, 10:48:03 PM1/29/17
to puppe...@googlegroups.com
Eric Sorenson updated an issue
Change By: Eric Sorenson
When you run {{puppet facts}}, you get something like:

{code}
{
 "name": "node name the facts is for",
 "timestamp": "when the facts were retrieved",
 "expiration": "not sure what this is telling us but its also not a fact",
 "values": { ..... these are the actual available facts .... }
}
{code}

This is because it's one of the "indirector faces," and it just spits back a serialized Puppet::Node::Facts object. I posit that
 literally  nobody wants this: the output of {{puppet facts}} should instead be consistent with that of {{facter}}, and it should have similar options for outputting as JSON or text.

One consequence of displaying an indirector object instead of a list of facts is that it's real easy to think "name" and "timestamp" are facts, when they're actually useless noise.

-----
Original description:

Some facts which show up when running 
{code:java}
puppet facts
{code}
are not available in templates (erb):

{code:java}
<%= @facts['timestamp'] %>
<%= @facts['name'] %>
{code}

The mentioned facts do not show up in facter -p


{code:java}
puppet --version
4.3.2
{code}

Geoff Nichols (JIRA)

unread,
Feb 1, 2017, 2:17:04 PM2/1/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Acceptance Criteria: "puppet facts" output is the same as from a run of Facter itself

Geoff Nichols (JIRA)

unread,
Feb 1, 2017, 2:18:27 PM2/1/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: AP  Grooming  2017-04-05

Geoff Nichols (JIRA)

unread,
Feb 1, 2017, 2:19:13 PM2/1/17
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Feb 24, 2017, 2:43:02 PM2/24/17
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

The crux of the issue is that puppet facts is a face application, and its actions, e.g. find, cause the indirected object to be rewritten directly to the console. In this case, it's a Puppet::Node::Facts object, which has name, values, timestamp fields. I don't think the current output format is useful to anyone.

I think our options are:

A. Modify puppet facts to always output the values, effectively unwrapping the facts object.
B. Modify puppet facts so it takes an option specifying the output format, and outputs the unwrapped values, e.g.

$ puppet facts --format flat
architecture => x86_64
...

$ puppet facts --format json
{
  "aio_agent_version": "1.9.1",
  "augeas": {
    "version": "1.4.0"
  },
  ...
}

$ puppet facts --format yaml
aio_agent_version: 1.9.1
augeas:
  version: 1.4.0
  ...

Martin Alfke (JIRA)

unread,
Feb 26, 2017, 7:25:02 AM2/26/17
to puppe...@googlegroups.com
Martin Alfke commented on Bug PUP-6040

Question:
when using the

--format flat

parameter

will structured facts still be shown?

Geoff Nichols (JIRA)

unread,
Mar 8, 2017, 2:46:02 AM3/8/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: Agent  2017-04-05  Ready for Engineering

Josh Cooper (JIRA)

unread,
Mar 10, 2017, 1:13:02 PM3/10/17
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

Good question Martin Alfke. I'd say we should output them in dotted notation:

$ puppet facts --format flat
...
os.release.major=15
os.release.minor=6
...

as that is consistent with facter's dotted notation:

$ facter os.release.major
15

/cc Peter Huene, Michael Smith

Michael Smith (JIRA)

unread,
Mar 10, 2017, 1:52:02 PM3/10/17
to puppe...@googlegroups.com
Michael Smith commented on Bug PUP-6040

That seems reasonable. Facter doesn't really have a parallel for --format flat, it uses a Puppet or Ruby hash-like syntax as the default output.

Peter Huene (JIRA)

unread,
Mar 10, 2017, 2:55:02 PM3/10/17
to puppe...@googlegroups.com
Peter Huene commented on Bug PUP-6040

Agreed with Michael; the dotted notation seems like the right approach for flat output.

Geoff Nichols (JIRA)

unread,
Mar 14, 2017, 11:50:03 PM3/14/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: Agent  5  Ready for Engineering

Josh Cooper (JIRA)

unread,
Mar 15, 2017, 12:19:03 PM3/15/17
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

Also I'd assume flat would emit 0-based indexes for array types, e.g.

$ puppet facts --format flat processors.models
processors.models.0=Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
processors.models.1=Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz

Also I just noticed facter uses --json and --yaml instead of --format json, so I'm thinking we should do the same for consistency, e.g. puppet facts --flat

Martin Alfke (JIRA)

unread,
Mar 15, 2017, 1:46:02 PM3/15/17
to puppe...@googlegroups.com
Martin Alfke commented on Bug PUP-6040

+1 for dotted notation
+1 for using similar options (puppet facts --flat)

Geoff Nichols (JIRA)

unread,
May 10, 2017, 1:45:03 PM5/10/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: Agent  Ready for Engineering  N+1

Sean McDonald (JIRA)

unread,
May 16, 2017, 2:39:03 PM5/16/17
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
May 25, 2017, 10:21:03 PM5/25/17
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 5.0.0
Fix Version/s: PUP 5.1.0

Josh Cooper (JIRA)

unread,
May 25, 2017, 10:22:02 PM5/25/17
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

Unfortunately this isn't going to make 5.0. Retargeting for 5.1, since we can add the new feature without breaking compatibility.

Geoff Nichols (JIRA)

unread,
Jul 25, 2017, 2:59:04 PM7/25/17
to puppe...@googlegroups.com
Geoff Nichols updated an issue
 
Change By: Geoff Nichols
Fix Version/s: PUP 5.1.0
Fix Version/s: PUP 5.2.0

Karen Van der Veer (JIRA)

unread,
Aug 4, 2017, 2:39:05 PM8/4/17
to puppe...@googlegroups.com

Karen Van der Veer (JIRA)

unread,
Aug 4, 2017, 2:40:07 PM8/4/17
to puppe...@googlegroups.com
Karen Van der Veer updated an issue
Change By: Karen Van der Veer
Sprint: Platform Core  2017-09-19  Grooming

Karen Van der Veer (JIRA)

unread,
Aug 9, 2017, 1:33:04 PM8/9/17
to puppe...@googlegroups.com
Karen Van der Veer updated an issue
Change By: Karen Van der Veer
Fix Version/s: PUP 5.2.0
Fix Version/s: PUP 5.y

Karen Van der Veer (JIRA)

unread,
Aug 9, 2017, 1:34:03 PM8/9/17
to puppe...@googlegroups.com

Reid Vandewiele (JIRA)

unread,
Oct 8, 2017, 5:02:02 PM10/8/17
to puppe...@googlegroups.com
Reid Vandewiele commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

1 on flat instead of -format flat. We should be striving for UX consistency with other Puppet commands, not Facter.

Nate McCurdy (JIRA)

unread,
Oct 8, 2017, 5:48:03 PM10/8/17
to puppe...@googlegroups.com
Nate McCurdy commented on Bug PUP-6040

Will puppet facts be able to show the value of a single fact? It should.

puppet facts os.networking for example.

Reid Vandewiele (JIRA)

unread,
Oct 9, 2017, 9:32:02 AM10/9/17
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 11, 2020, 3:02:03 AM6/11/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Coremunity Night's Watch
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Jan 27, 2021, 12:44:04 PM1/27/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6040
 
Re: "puppet facts" outputs indirector object instead of simple fact list

This ticket was implemented in a number of other PUP tickets, so I'm going to close this, and summarize the current behavior below:

Facts (just the names and values) are shown in JSON by default:

# puppet facts show
{
  "os": {
    "release": {
      "full": "7.2",
      "major": "7",
      "minor": "2"
    },
...
}

A subtree can be requested using dotted notation:

# puppet facts show os.release
{
  "os.release": {
    "full": "7.2",
    "major": "7",
    "minor": "2"
  }
}

A single fact value can be requested (note due to PUP-10861 the fact value is quoted when it shouldn't be):

# puppet facts show os.release.full --value-only
"7.2"

It's also possible to render the output as "flat" which is easier to parse by external automation. To Reid Vandewiele's point, this uses the existing "--render-as" puppet CLI argument rather than --flat:

# puppet facts show os.release --render-as flat
os.release.full=7.2
os.release.major=7
os.release.minor=2

Puppet is not consistent about --render-as, --format, --to_yaml, but that's a different issue.

Reply all
Reply to author
Forward
0 new messages