def hostname(hf, hd, hs, sid):
    """
    .. warning::
        This combiner methode is deprecated, please use
        :py:class:`insights.combiners.hostname.Hostname` instead.

    Check hostname and systemid to get the fqdn, hostname and domain.

    Prefer hostname to systemid.

    Examples:
        >>> hn.fqdn
        'rhel7.example.com'
        >>> hn.hostname
        'rhel7'
        >>> hn.domain
        'example.com'

    Returns:
        insights.combiners.hostname.Hostname: A class with `fqdn`,
        `hostname` and `domain` attributes.

    Raises:
        Exception: If no hostname can be found in any of the source parsers.
    """
    deprecated(hostname, "Use the `Hostname` class instead.")
    return Hostname(hf, hd, hs, sid)
Exemple #2
0
    def reconstitute(path, d):
        """
        .. warning::
            This function is deprecated.  Please use the `raw_lines` dictionary
            property of the parser instance instead, as this contains the actual
            lines from the exports file.

        'Reconstitute' a line from its parsed value.  The original lines are
        not used for this.  The hosts in d are listed in alphabetical order,
        and the options are listed in the order originally given.

        Arguments:
            path (str): The exported path
            d (dict): The hosts definition of the exported path

        Returns:
            str: A line simulating the definition of that exported path to
            those hosts.
        """
        deprecated(
            NFSExportsBase.reconstitute,
            'Please use the `raw_lines` dictionary property of the parser instance'
        )
        return "  ".join([path] + [
            "%s(%s)" % (host, ",".join(options))
            for host, options in d.items()
        ])
Exemple #3
0
 def __init__(self, *args, **kwargs):
     deprecated(
         SatelliteKatelloEmptyURLRepositories,
         'Please use the SatelliteQualifiedKatelloRepos parser in the current module.'
     )
     super(SatelliteKatelloEmptyURLRepositories,
           self).__init__(*args, **kwargs)
    def __init__(self, data):
        deprecated(YumInstalledRpm,
                   "Import YumListRpm from insights.parsers.yum_list instead")
        self.repo = None
        """str: yum / dnf repository name, if available."""

        super(YumInstalledRpm, self).__init__(data)
Exemple #5
0
def get_multipath_v4_ll(context):
    """
    .. warning::
        Deprecated parser, please use :class:`MultipathDevices` instead.
    """
    deprecated(get_multipath_v4_ll, "Use the `MultipathDevices` class instead.")
    return MultipathDevices(context).devices
    def __init__(self, context):
        deprecated(
            YumListInstalled,
            "Import YumListBase from insights.parsers.yum_list instead")
        self.expired_cache = False
        """bool: Indicates if the yum repo cache is expired."""

        super(YumListInstalled, self).__init__(context)
Exemple #7
0
 def __init__(self, package_provides_java):
     deprecated(
         PackageProvidesJavaAll,
         'Please use the :class:`insights.parsers.package_provides.PackageProvidesCommand` instead.'
     )
     self.data = {}
     for pkg in package_provides_java:
         self.data[pkg.command] = pkg.package
     super(PackageProvidesJavaAll, self).__init__()
Exemple #8
0
    def __init__(self, httpd_conf):
        deprecated(
            HttpdConfAll,
            "Import HttpdConfTree from 'insights.combiners.httpd_conf' instead."
        )

        self.data = {}
        self.config_data = []

        config_files_data = []
        main_config_data = []

        for httpd_parser in httpd_conf:
            file_name = httpd_parser.file_name
            file_path = httpd_parser.file_path

            # Flag to be used for different handling of the main config file
            main_config = httpd_parser.file_name == 'httpd.conf'

            if not main_config:
                config_files_data.append(
                    self.ConfigData(file_name, file_path, httpd_parser.data))
            else:
                main_config_data.append(
                    self.ConfigData(file_name, file_path,
                                    httpd_parser.first_half))
                main_config_data.append(
                    self.ConfigData(file_name, file_path,
                                    httpd_parser.second_half))

        # Sort configuration files
        config_files_data.sort()

        # Add both parts of main configuration file and store as attribute.
        # These values can be used when looking for bad settings which are not actually active
        # but may become active if other configurations are changed
        if main_config_data:
            self.config_data = [main_config_data[0]
                                ] + config_files_data + [main_config_data[1]]
        else:
            self.config_data = config_files_data

        # Store active settings - the last parsed value us stored
        self.data = {}
        for _, _, full_data in self.config_data:
            copy_data = full_data.copy()
            for option, parsed_data in copy_data.items():
                if isinstance(parsed_data, dict):
                    if option not in self.data:
                        self.data[option] = {}
                    dict_deep_merge(self.data[option], parsed_data)
                else:
                    if option not in self.data:
                        self.data[option] = []
                    self.data[option].extend(parsed_data)
Exemple #9
0
 def __init__(self, rel, ps, hv, hev, hwv):
     deprecated(HttpdV, "Use the `HttpdV` parser in `insights.parsers.httpd_V`.")
     super(HttpdV, self).__init__()
     rhel_ver = rel.major
     self.data = hv.data if hv else None
     if rhel_ver == 6:
         if ps.fuzzy_match('httpd.worker'):
             self.data = hwv.data if hwv else None
         elif ps.fuzzy_match('httpd.event'):
             self.data = hev.data if hev else None
     if self.data is None:
         raise SkipComponent("Unable to get the valid `httpd -V` command")
 def parse_content(self, content):
     deprecated(
         PackageProvidesHttpd,
         'Please use the :class:`insights.parsers.package_provides.PackageProvidesCommand` instead.'
     )
     if len(content) == 0:
         raise SkipException("Error: ", 'there is not httpd application running')
     l = content[0].split()
     if len(l) != 2:
         raise SkipException("Error: ",
                             'current running httpd command is not provided by package installed through yum or rpm')
     self.command = l[0]
     self.package = l[1]
Exemple #11
0
def is_running(context):
    """
    .. warning::
        This function parser is deprecated, please use :py:class:`KSMState`
        instead.

    Check if Kernel Samepage Merging is enabled. 'True' if KSM is
    on (i.e. ``/sys/kernel/mm/ksm/run`` is '1') or 'False' if not.
    """
    deprecated(is_running, "Use the `KSMState` class instead.")
    ksminfo = {}
    ksminfo['running'] = (context.content[0].split()[0] == '1')
    return ksminfo
Exemple #12
0
 def __init__(self, local, shared):
     deprecated(HttpdV, "Use the `HttpdV` parser in `insights.parsers.httpd_V`.")
     super(HttpdV, self).__init__()
     rhel_ver = shared[redhat_release].major
     self.data = shared[HV].data if HV in shared else None
     if rhel_ver == 6:
         ps = shared[PsAuxww]
         if ps.fuzzy_match('httpd.worker'):
             self.data = shared[HWV].data if HWV in shared else None
         elif ps.fuzzy_match('httpd.event'):
             self.data = shared[HEV].data if HEV in shared else None
     if self.data is None:
         raise SkipComponent("Unable to get the valid `httpd -V` command")
Exemple #13
0
 def parse_content(self, content):
     deprecated(PluginConfD, "Deprecated. Use 'PluginConfDIni' instead.")
     plugin_dict = {}
     section_dict = {}
     key = None
     for line in get_active_lines(content):
         if line.startswith('['):
             section_dict = {}
             plugin_dict[line[1:-1]] = section_dict
         elif '=' in line:
             key, _, value = line.partition("=")
             key = key.strip()
             section_dict[key] = value.strip()
         else:
             if key:
                 section_dict[key] = ','.join([section_dict[key], line])
     self.data = plugin_dict
Exemple #14
0
def parse_systemd_ini(content):
    """
    .. warning::
        This function is deprecated, please use :py:class:`SystemdConf` instead.

    Function to parse config format file, the result format is dictionary.
    """

    deprecated(parse_systemd_ini, "Use the `SystemdConf` class instead.")

    doc = parse_doc(content)

    dict_all = {}
    for section in doc:
        section_dict = {}
        option_names = set(o.name for o in section)
        for name in option_names:
            options = [str(o.value) for o in section[name]]
            section_dict[name] = options[0] if len(options) == 1 else options
        dict_all[section.name] = section_dict

    return dict_all
Exemple #15
0
def uptime(ut):
    """
    .. warning::
       This combiner method is deprecated, please use
       :py:class:`insights.parsers.uptime.Uptime` instead.

    Check uptime to get the uptime information.

    Returns:
        insights.combiners.uptime.Uptime: A named tuple with `currtime`,
        `updays`, `uphhmm`, `users`, `loadavg` and `uptime` components.

    Raises:
        SkipComponent: If no data is available or if ``loadavg`` is not available.
    """
    deprecated(uptime, "Use the `Uptime` parser instead.")

    if ut.loadavg:
        return Uptime(ut.currtime, ut.updays, ut.uphhmm, ut.users, ut.loadavg,
                      ut.uptime)

    raise SkipComponent("Unable to get uptime information.")
def redhat_release(rh_release, un):
    """
    .. warning::
        This combiner methode is deprecated, please use
        :py:class:`insights.combiners.redhat_release.RedHatRelease` instead.

    Combiner method to check uname and redhat-release for rhel major/minor
    version.

    Prefer uname to redhat-release.

    Returns:
        Release: A named tuple with the following items:
            - major: integer
            - minor: integer

    Raises:
        ParseException: If the version can't be determined even though a Uname
            or RedhatRelease was provided.

    Examples:
        >>> rh_release.major
        7
        >>> rh_release.minor
        2
        >>> rh_release
        Release(major=7, minor=2)

    """

    deprecated(redhat_release, "Use the `RedHatRelease` class instead.")

    if un and un.release_tuple[0] != -1:
        return Release(*un.release_tuple)

    if rh_release:
        return Release(rh_release.major, rh_release.minor)

    raise ParseException("Unabled to determine release.")
Exemple #17
0
 def __init__(self, *args, **kwargs):
     deprecated(CephVersionError, "Use SkipException instead.")
     super(CephVersionError, self).__init__(*args, **kwargs)
Exemple #18
0
 def __init__(self, *args, **kwargs):
     deprecated(DockerStorageSetup, "Import DockerStorageSetupSysconfig from insights.parsers.sysconfig instead")
     super(DockerStorageSetup, self).__init__(*args, **kwargs)
Exemple #19
0
 def __init__(self, *args, **kwargs):
     deprecated(
         CoroSyncConfig,
         "Import CorosyncSysconfig from insights.parsers.sysconfig instead")
     super(CoroSyncConfig, self).__init__(*args, **kwargs)
Exemple #20
0
 def __init__(self, *args, **kwargs):
     deprecated(
         EngineLog,
         "Import EngineLog from insights.parsers.ovirt_engine_log instead")
     super(EngineLog, self).__init__(*args, **kwargs)
Exemple #21
0
 def __init__(self, *args, **kwargs):
     deprecated(
         VirtUuidFacts,
         "Import SubscriptionManagerFactsList from insights.parsers.subscription_manager_list instead"
     )
     super(VirtUuidFacts, self).__init__(*args, **kwargs)
Exemple #22
0
 def deprecated_fn():
     deprecated(deprecated_fn, "really don't use this")
     return 3
Exemple #23
0
 def __init__(self, *args, **kwargs):
     deprecated(IpcsS, "Import IpcsS from insights.parsers.ipcs instead")
     super(IpcsS, self).__init__(*args, **kwargs)
Exemple #24
0
 def __init__(self, *args, **kwargs):
     deprecated(
         NginxConf,
         "Import NginxConfTree from insights.combiners.nginx_conf instead")
     super(NginxConf, self).__init__(*args, **kwargs)
 def __init__(self, *args, **kwargs):
     deprecated(AWSInstanceType, "Use AWSInstanceIdDoc in insights.insights.aws_instance_id instead.")
     super(AWSInstanceType, self).__init__(*args, **kwargs)
Exemple #26
0
 def __init__(self, *args, **kwargs):
     deprecated(ForemanTasksConfig, "Import ForemanTasksSysconfig from insights.parsers.sysconfig instead")
     super(ForemanTasksConfig, self).__init__(*args, **kwargs)
Exemple #27
0
 def __init__(self, *args, **kwargs):
     deprecated(HttpdWorkerV, "Use the `HttpdV` parser in this module.")
     super(HttpdWorkerV, self).__init__(*args, **kwargs)
Exemple #28
0
 def __init__(self, *args, **kwargs):
     deprecated(
         UdevRules40Redhat,
         "Import UdevRules40Redhat from insights.parsers.udev_rules instread."
     )
     super(UdevRules40Redhat, self).__init__(*args, **kwargs)
Exemple #29
0
 def __init__(self, *args, **kwargs):
     deprecated(MultiOrderedDict, "This class is deprecated")
     super(MultiOrderedDict, self).__init__(*args, **kwargs)
Exemple #30
0
 def __init__(self, *args, **kwargs):
     deprecated(
         NetConsole,
         "Import NetconsoleSysconfig from insights.parsers.sysconfig instead"
     )
     super(NetConsole, self).__init__(*args, **kwargs)