Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured facts display could be improved #83

Closed
gertvdijk opened this issue Jun 26, 2014 · 8 comments
Closed

Structured facts display could be improved #83

gertvdijk opened this issue Jun 26, 2014 · 8 comments

Comments

@gertvdijk
Copy link
Contributor

Facter 2.0 introduced structured facts (compared to only key-value pairs in 1.x). In the 2.0.x series of Facter, no structured facts were provided by default. However, as stated in the Facter 2.1.0 announcement, now partitions is the first standard structured fact (hash).

Please add support for this in Puppetboard. By support I mean one should think of a way it can be displayed 'nicely', rather than for example:

partitions  {"vda1"=>{"uuid"=>"af740304-b2c6-440f-877a-5fb15cf86c39", "size"=>"12578816", "filesystem"=>"ext4"}}
@daenney
Copy link
Member

daenney commented Jun 26, 2014

PuppetDB doesn't store structured facts in any sane way so I'd have to start doing string parsing, loading it as JSON and deal with a whole bunch of edge cases and issues that can arise from there. Besides that it can be rather complex to get it right depending on how crazy people go with structured facts. That's a lot of work and very fragile code which I'm not willing to pull in.

A design to store structured facts in PuppetDB and the API around it is going to be up soon for discussion. I'll chime in on that and make sure we get something that we can work with. Once that lands we can add support for it in Puppetboard in good and reliable way and correctly detect and differentiate between 'old' and structured facts. This would also affect other things like the ability to be able to query for a certain value out of a structured fact for example.

It's a bit unfortunate that structured facts landed before PuppetDB could actually deal with them in a nice way but it is what it is.

@gertvdijk
Copy link
Contributor Author

Fair enough.

With Puppetboard relying heavily on PuppetDB's API and without sane support (PDB-28) in it I agree this is a slippery slope.

@daenney
Copy link
Member

daenney commented Jun 26, 2014

I'm reopening this, just so that there is an issue about it and that people can find the rationale for it. I'll close it in due time through a commit once this gets fixed.

@daenney daenney reopened this Jun 26, 2014
@corey-hammerton
Copy link
Contributor

Starting with PuppetDB 3.0 Structured facts are available in JSON format and new endpoints fact-paths, fact-contents and factsets are available.

As @daenney said it is a lot of work to implement reliable browsing in PuppetBoard with both string and JSON type fact values. This will be on the backlog but if anybody really needs this support please submit a PR with a link to this issue.

@daenney
Copy link
Member

daenney commented Oct 28, 2015

So Puppetboard has a jsonprint template filter that you can use, see templates/metric.html and templates/query.html.

It doesn't provide for a nice way to browse and click through it but will at least print it as more humanly readable JSON instead of a long string.

@corey-hammerton
Copy link
Contributor

We are open to PRs if anyone wants to attempt to implement an API for this. Hopefully it can make it into the 0.2.x series.

@corey-hammerton
Copy link
Contributor

As of PuppetDB 4.2.0 a new Inventory endpoint is being provided as well as "dotted query" syntax is made available, also the dot notation is experimental.

It may be possible to make use of these new features in the 0.3.0 series with PuppetDB 5.0.0.

b4ldr pushed a commit to b4ldr/puppetboard that referenced this issue Feb 19, 2020
* Version bump to 0.2.2

- Added an entry in CHANGELOG.rst with highlights of this release
- Fixed URL paths with the new voxpupuli organization in README.rst
- Changing the author from Daniele Sluijters to Corey Hammerton in
  setup.py

* CHANGELOG.rst: Adding entry for change commited for voxpupuli/pypuppetdb#75

* CHANGELOG.rst: Adding entry for voxpupuli/pypuppetdb#80

* Version bump to 0.2.3

* CHANGELOG.rst: Adding changelog entry for the new fix.
gdubicki added a commit that referenced this issue Nov 29, 2021
and extend the width of the fact values column in the node
view as the values are usually longer that the names.
Thus this implements #83.

Also fix getting nodes with non-string fact values (#612):
Examples:
* int (in this case the filtering did not occur at all
  and ALL results were returned),
* list of dict (here the filtering was not done and
  ZERO results were returned),

As showing fact values does not use the code that strips
trailing 'u' anymore, this also fixes #567.
gdubicki added a commit that referenced this issue Nov 29, 2021
and extend the width of the fact values column in the node
view as the values are usually longer that the names.
Thus this implements #83.

Also fix getting nodes with non-string fact values (#612):
Examples:
* int (in this case the filtering did not occur at all
  and ALL results were returned),
* list of dict (here the filtering was not done and
  ZERO results were returned),

As showing fact values does not use the code that strips
trailing 'u' anymore, this also fixes #567.
@gdubicki
Copy link
Contributor

Fixed in v3.3.0 released today. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants