Source code for insights.parsers.sat5_insights_properties

Sat5InsightsProperties - File ````
from insights.core import LegacyItemAccess, Parser
from insights.core.exceptions import SkipComponent
from insights.core.plugins import parser
from insights.parsers import get_active_lines
from insights.specs import Specs

[docs] @parser(Specs.sat5_insights_properties) class Sat5InsightsProperties(LegacyItemAccess, Parser): """ Class to parse configuration file ``/etc/redhat-access/`` on Satellite 5 Server. The typical content is:: portalurl = enabled = true debug = true rpmname = redhat-access-insights Examples: >>> insights_props.enabled True >>> insights_props['debug'] 'true' >>> insights_props['rpmname'] 'redhat-access-insights' Attributes: enabled (bool): True when insights is enabled on the Satellite 5. Otherwise, False Raises: SkipComponent: When file content is empty. """
[docs] def parse_content(self, content): if not content: raise SkipComponent('Empty content.') = {} for line in get_active_lines(content): key, value = [l.strip() for l in line.split('=', 1)][key] = value self.enabled = self.get('enabled') == 'true'