Skip to content

Commit

Permalink
parsers: add more docs to image_builder_facts
Browse files Browse the repository at this point in the history
  • Loading branch information
croissanne committed Oct 30, 2024
1 parent 56ad55d commit 00b82c1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
3 changes: 3 additions & 0 deletions docs/shared_parsers_catalog/image_builder_facts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. automodule:: insights.parsers.image_builder_facts
:members:
:show-inheritance:
38 changes: 28 additions & 10 deletions insights/parsers/image_builder_facts.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
"""
ImageBuilderFacts - files ``/etc/rhsm/facts/osbuild.facts``
=========================================================
ImageBuilderFacts - file ``/etc/rhsm/facts/osbuild.facts``
==========================================================
This module provides parsing for the ``/etc/rhsm/facts/osbuild.facts`` file.
The ``ImageBuilderFacts`` class is based on a shared class which processes the JSON
information into a dictionary.
Sample input data looks like::
{
"image-builder.insights.compliance-policy-id": "61812cce-c884-4d52-bf05-15b41370db23",
"image-builder.insights.compliance-profile-id": "xccdf_org.ssgproject.content_profile_cis",
"image-builder.osbuild-composer.api-type": "cloudapi-v2"
}
"""

from insights.core import JSONParser
Expand All @@ -22,4 +14,30 @@

@parser(Specs.image_builder_facts)
class ImageBuilderFacts(JSONParser):
"""
Parses the ``/etc/rhsm/facts/osbuild.facts`` file.
Sample input::
{
"image-builder.insights.compliance-policy-id": "61812cce-c884-4d52-bf05-15b41370db23",
"image-builder.insights.compliance-profile-id": "xccdf_org.ssgproject.content_profile_cis",
"image-builder.osbuild-composer.api-type": "cloudapi-v2"
}
Output will be a python object with the same structure as the JSON::
{
"image-builder.insights.compliance-policy-id": "61812cce-c884-4d52-bf05-15b41370db23",
"image-builder.insights.compliance-profile-id": "xccdf_org.ssgproject.content_profile_cis",
"image-builder.osbuild-composer.api-type": "cloudapi-v2"
}
Example:
>>> type(image_builder_facts)
<class 'insights.parsers.image_builder_facts.ImageBuilderFacts'>
>>> image_builder_facts["image-builder.insights.compliance-policy-id"] == "61812cce-c884-4d52-bf05-15b41370db23"
True
"""
pass

0 comments on commit 00b82c1

Please sign in to comment.