diff --git a/docs/shared_parsers_catalog/image_builder_facts.rst b/docs/shared_parsers_catalog/image_builder_facts.rst new file mode 100644 index 000000000..ff11eca9c --- /dev/null +++ b/docs/shared_parsers_catalog/image_builder_facts.rst @@ -0,0 +1,3 @@ +.. automodule:: insights.parsers.image_builder_facts + :members: + :show-inheritance: diff --git a/insights/parsers/image_builder_facts.py b/insights/parsers/image_builder_facts.py index 3b3edb7bd..c92bbd9d0 100644 --- a/insights/parsers/image_builder_facts.py +++ b/insights/parsers/image_builder_facts.py @@ -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 @@ -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) + + >>> image_builder_facts["image-builder.insights.compliance-policy-id"] == "61812cce-c884-4d52-bf05-15b41370db23" + True + """ pass