|
8 | 8 | * :py:class:`insights.parsers.systemd.unitfiles.ListUnits` |
9 | 9 | * :py:class:`insights.parsers.redhat_release.RedhatRelease` |
10 | 10 | """ |
| 11 | +from insights.core.exceptions import SkipComponent |
11 | 12 | from insights.core.plugins import combiner |
12 | 13 | from insights.parsers.cmdline import CmdLine |
13 | 14 | from insights.parsers.installed_rpms import InstalledRpms |
14 | 15 | from insights.parsers.systemd.unitfiles import ListUnits |
15 | 16 | from insights.parsers.redhat_release import RedhatRelease |
| 17 | +from insights.parsers.rpm_ostree_status import RpmOstreeStatus |
16 | 18 |
|
17 | 19 |
|
18 | | -@combiner(InstalledRpms, CmdLine, ListUnits, RedhatRelease) |
| 20 | +@combiner(ListUnits, optional=[RpmOstreeStatus, InstalledRpms, CmdLine, RedhatRelease]) |
19 | 21 | class RhelForEdge(object): |
20 | 22 | """Combiner for checking if the system is an edge computing system. Edge |
21 | 23 | computing as well as the Red Hat CoreOS packages are managed via rpm-ostree. |
@@ -58,13 +60,22 @@ class RhelForEdge(object): |
58 | 60 |
|
59 | 61 | """ |
60 | 62 |
|
61 | | - def __init__(self, rpms, cmdline, units, redhatrelease): |
| 63 | + def __init__(self, units, rpmostreestatus, rpms, cmdline, redhatrelease): |
62 | 64 | self.is_edge = False |
63 | 65 | self.is_automated = False |
64 | | - |
65 | | - if ('rpm-ostree' in rpms and 'yum' not in rpms) and \ |
66 | | - ('ostree' in cmdline) and \ |
67 | | - ("red hat enterprise linux release" in redhatrelease.raw.lower()): |
68 | | - self.is_edge = True |
69 | | - if units.is_running("rhcd.service"): |
70 | | - self.is_automated = True |
| 66 | + if rpmostreestatus: |
| 67 | + origin = rpmostreestatus.query.deployments.origin |
| 68 | + origin_check = [item.value.endswith("edge") for item in origin] |
| 69 | + if origin_check and all(origin_check): |
| 70 | + self.is_edge = True |
| 71 | + if units.is_running("rhcd.service"): |
| 72 | + self.is_automated = True |
| 73 | + elif rpms and cmdline and redhatrelease: |
| 74 | + if ('rpm-ostree' in rpms and 'yum' not in rpms) and \ |
| 75 | + ('ostree' in cmdline) and \ |
| 76 | + ("red hat enterprise linux release" in redhatrelease.raw.lower()): |
| 77 | + self.is_edge = True |
| 78 | + if units.is_running("rhcd.service"): |
| 79 | + self.is_automated = True |
| 80 | + else: |
| 81 | + raise SkipComponent("Unable to determine if this system is created from an edge image.") |
0 commit comments