Skip to content

Commit

Permalink
[insights-core-3.0.300] Remove deprecated features (#3595)
Browse files Browse the repository at this point in the history
* [insights-core-3.0.300] Remove deprecated features

Signed-off-by: Sachin Patil <[email protected]>

* Revert combiners.ModInfo

Also delay the removal of ModInfoAll & ModInfoEach parsers from 3.0.300 to
3.1.25

Signed-off-by: Sachin Patil <[email protected]>

* Fixed the docstring
* Removed unused specs

Signed-off-by: Sachin Patil <[email protected]>
(cherry picked from commit b7155d0)
  • Loading branch information
Sachin authored and xiangce committed Nov 29, 2022
1 parent dbf098f commit 1e6ec15
Show file tree
Hide file tree
Showing 69 changed files with 34 additions and 3,763 deletions.
3 changes: 0 additions & 3 deletions docs/shared_combiners_catalog/package_provides_httpd.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_combiners_catalog/package_provides_java.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_combiners_catalog/uptime.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/aws_instance_type.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/dirsrv_sysconfig.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/docker_storage_setup.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/etc_udev_rules.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/foreman_tasks_config.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/lsvmbus.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/netconsole.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/package_provides_httpd.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/package_provides_java.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/puppetserver_config.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/shared_parsers_catalog/yum_list_installed.rst

This file was deleted.

1 change: 0 additions & 1 deletion insights/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from .core import FileListing, LegacyItemAccess, SysconfigOptions # noqa: F401
from .core import Parser, ContainerParser # noqa: F401
from .core import YAMLParser, JSONParser, XMLParser, CommandParser # noqa: F401
from .core import AttributeDict # noqa: F401
from .core import Syslog # noqa: F401
from .core import taglang
from .core.archives import COMPRESSION_TYPES, extract, InvalidArchive, InvalidContentType # noqa: F401
Expand Down
32 changes: 0 additions & 32 deletions insights/combiners/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
"""

from insights.core.plugins import combiner
from insights.core.serde import deserializer, serializer
from insights.parsers.hostname import Hostname as HnF, HostnameShort as HnS, HostnameDefault as HnD
from insights.parsers.systemid import SystemID
from insights.util import deprecated


@combiner([HnF, HnD, HnS, SystemID])
Expand Down Expand Up @@ -56,36 +54,6 @@ def __init__(self, hf, hd, hs, sid):
raise Exception("Unable to get hostname.")


@combiner([HnF, HnD, HnS, SystemID])
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.", "3.0.300")
return Hostname(hf, hd, hs, sid)


@serializer(Hostname)
def serialize(obj, root=None):
return {"fqdn": obj.fqdn, "hostname": obj.hostname, "domain": obj.domain}
Expand Down
25 changes: 5 additions & 20 deletions insights/combiners/modinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@
ModulesInfo
-----------
The ModulesInfo combines the collected modules info.
It combines the result of ``KernelModulesInfo``, ``ModInfoI40e``,
``ModInfoIgb``, ``ModInfoIxgbe``, ``ModInfoVeth``, ``ModInfoVmxnet3``
if they exists.
The ModulesInfo combines the collected modules info from the result of
``KernelModulesInfo``.
"""

from insights.core.plugins import combiner
from insights.parsers import SkipException
from insights.parsers.modinfo import ModInfoEach, ModInfoAll
from insights.parsers.modinfo import (
KernelModulesInfo, ModInfoI40e, ModInfoIgb, ModInfoIxgbe, ModInfoVeth,
ModInfoVmxnet3
)
from insights.parsers.modinfo import (KernelModulesInfo, ModInfoEach, ModInfoAll)
from insights import SkipComponent
from insights.util import deprecated

Expand Down Expand Up @@ -94,11 +88,7 @@ def data(self):
return self


@combiner(
[
KernelModulesInfo, ModInfoI40e, ModInfoIgb, ModInfoIxgbe, ModInfoVeth,
ModInfoVmxnet3
])
@combiner([KernelModulesInfo])
class ModulesInfo(dict):
"""
Combiner to combine the result of KernelModulesInfo which supports filter
Expand All @@ -120,17 +110,12 @@ class ModulesInfo(dict):
retpoline_y (set): A set of names of the modules with the attribute "retpoline: Y".
retpoline_n (set): A set of names of the modules with the attribute "retpoline: N".
"""
def __init__(self, filtered_modules_info, i40e_info, igb_info, ixgbe_info, veth_info, vmxnet3_info):
def __init__(self, filtered_modules_info):
self.retpoline_y = set()
self.retpoline_n = set()
if filtered_modules_info:
self.update(filtered_modules_info)
self.retpoline_n = filtered_modules_info.retpoline_n
self.retpoline_y = filtered_modules_info.retpoline_y
for item in filter(None, [i40e_info, igb_info, ixgbe_info, veth_info, vmxnet3_info]):
name = item.module_name
self[name] = item
self.retpoline_y.add(name) if item.get('retpoline') == 'Y' else None
self.retpoline_n.add(name) if item.get('retpoline') == 'N' else None
if not self:
raise SkipException
83 changes: 0 additions & 83 deletions insights/combiners/package_provides_httpd.py

This file was deleted.

82 changes: 0 additions & 82 deletions insights/combiners/package_provides_java.py

This file was deleted.

43 changes: 0 additions & 43 deletions insights/combiners/redhat_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from insights.parsers.uname import Uname
from insights.core.serde import serializer, deserializer
from insights.parsers import SkipComponent
from insights.util import deprecated


Release = namedtuple("Release", field_names=["major", "minor"])
Expand All @@ -34,48 +33,6 @@ def deserialize(_type, obj, root=None):
return Release(**obj)


@combiner([rht_release, Uname])
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:
SkipComponent: 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.", "3.0.300")

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 SkipComponent("Unabled to determine release.")


@combiner([Uname, rht_release])
class RedHatRelease(object):
"""
Expand Down
Loading

0 comments on commit 1e6ec15

Please sign in to comment.