| Summary: | Structured facts - not supported? | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Karl Abbott <kabbott> | ||||
| Component: | Fact | Assignee: | satellite6-bugs <satellite6-bugs> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Sanket Jagtap <sjagtap> | ||||
| Severity: | urgent | Docs Contact: | |||||
| Priority: | urgent | ||||||
| Version: | 6.2.5 | CC: | andrew.schofield, bbuckingham, jcallaha, kabbott, mhulan, sjagtap, tstrachota | ||||
| Target Milestone: | Unspecified | Keywords: | Triaged | ||||
| Target Release: | Unused | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2018-02-21 17:09:57 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
|
Description
Karl Abbott
2016-11-04 12:53:19 UTC
Thanks for the report Karl, I don't see any private information in the BZ, could you please publish it? The support for structured facts was merged upstream in Foreman 1.13. I'm not sure I understand part b), our API responds in JSON format, how would you call #class or #is_a?(Hash) on it? I'll defer to Andrew Schofield on that question as he is the one who filed the issue with us. Cheers, Karl Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/4528 has been resolved. (In reply to Marek Hulan from comment #2) > Thanks for the report Karl, I don't see any private information in the BZ, > could you please publish it? The support for structured facts was merged > upstream in Foreman 1.13. I'm not sure I understand part b), our API > responds in JSON format, how would you call #class or #is_a?(Hash) on it? Marek - with regards to (b) I'm asking that, using the API, I can run something like JSON.parse converting into ruby objects then call to identify the format of the fact from there. So long as the original value of the structured fact is being returned via the API. Thanks for explanation. That's currently not possible, we only list facts as key value combination and constructing of all composed values might be performance issue for multiple facts. Maybe we could add this if users asks for specific fact only, in other words add a show action for signle fact, if you're interested, please open a separate RFE for this. Today you could write a simple script that combines facts loaded through API and constructs the composite value for you. This class might be useful - https://github.com/theforeman/foreman_chef/blob/d460134c221ccb7cd38c2df6eafcaade7457fdf2/app/models/foreman_chef/fact_importer.rb#L110-L129 With class like it you'd just load all facts into a hash and then call something like this: Sparser.new.unsparse({'a::b::c' => 'x', 'a::b::d' => 'y'}, :separator => '::') This results in {"a"=>{"b"=>{"c"=>"x", "d"=>"y"}}} Build: Satellite 6.3 snap 17
/api/fact_values?search=name+%3D+partitions
Returned structured facts
"results": {"nikb39237be-87ca-4705-b7b2-500eee158fe5.sat.com":{"partitions":"{\"sda1\"=>{\"uuid\"=>\"41baa60f-8ed1-476f-80b2-138b5a888d21\", \"size\"=>\"2097152\", \"mount\"=>\"/boot\", \"filesystem\"=>\"xfs\"}, \"sda2\"=>{\"size\"=>\"39843840\", \"filesystem\"=>\"LVM2_member\"}}"},"nika7da3a2c-842a-4528-b16c-9a3b1a6ed4c5.sat.com":{"partitions":"{\"sda1\"=>{\"uuid\"=>\"c4effd3e-74cf-4d57-94ed-74df5b8b7b9d\", \"size\"=>\"2097152\", \"mount\"=>\"/boot\", \"filesystem\"=>\"xfs\"}, \"sda2\"=>{\"size\"=>\"39843840\", \"filesystem\"=>\"LVM2_member\"}}"},"nik8fe0d0c1-4350-42ef-ade4-592a02db25d1.sat.com":{"partitions":"{\"sda1\"=>{\"uuid\"=>\"ed7d5292-52ef-4739-aad5-e643cfa0f689\", \"size\"=>\"2097152\", \"mount\"=>\"/boot\", \"filesystem\"=>\"xfs\"}, \"sda2\"=>{\"size\"=>\"39843840\", \"filesystem\"=>\"LVM2_member\"}}"},"nik5d814a9e-7b49-47f5-be7c-ecedc4cbb22f.sat.com":{"partitions":"{\"sda1\"=>{\"uuid\"=>\"f6c7f405-f1bd-432c-bfca-6e6efa2e30da\", \"size\"=>\"2097152\", \"mount\"=>\"/boot\", \"filesystem\"=>\"xfs\"}, \"sda2\"=>{\"size\"=>\"39843840\", \"filesystem\"=>\"LVM2_member\"}}"},"todd-lolar.sat.com":{"partitions":"{\"vda1\"=>{\"uuid\"=>\"17eb29dd-a0c5-43f5-856c-c0d48d8734bd\", \"size\"=>\"2097152\", \"mount\"=>\"/boot\", \"filesystem\"=>\"xfs\"}, \"vda2\"=>{\"size\"=>\"18872320\", \"filesystem\"=>\"LVM2_member\"}}"}}
}
Also, UI , lists the structured facts in correct format.
However I ran into issue while searching in structured facts with IN operator
Tracking here https://bugzilla.redhat.com/show_bug.cgi?id=1496322
Created attachment 1331293 [details]
UI struct facts
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:0336 |