We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Double Check satellite_version.CapsuleVersion Combiner
CapsuleVersion Combiner currently relies on satellite-capsule package.

satellite-capsule package can be installed on satellite server t0o and plugin rules may use the combiner to wrongly identify satellite server as capsule.

"foreman" package would not be there on Capsule server and hence can be added as a check. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `insights/combiners/satellite_version.py`
Content:
```
1 """
2 Satellite Version
3 =================
4 
5 The following modules are included:
6 
7 SatelliteVersion - Version of Satellite Server
8 ----------------------------------------------
9 Combiner to get Satellite Server version information.
10 
11 CapsuleVersion - Version of Satellite Capsule (>=6.2)
12 -----------------------------------------------------
13 Combiner to get Satellite Capsule version information. ONLY Satellite Capsule
14 6.2 and newer are supported.
15 
16 
17 """
18 
19 from insights import combiner, SkipComponent
20 from insights.parsers.satellite_version import Satellite6Version as Sat6Ver
21 from insights.parsers.installed_rpms import InstalledRpms
22 
23 
24 # NOTE:
25 # The following table only tracks 6.0.x and 6.1.x.
26 # See https://access.redhat.com/articles/1343683
27 # But, there are some mistakes in the KCS, the versions in below map
28 # are corrected according to the corresponding ERRATA pages.
29 #
30 # Update: Thu Nov 14 10:51:19 CST 2019
31 #
32 sat6_ver_map = {
33         # Sat     foreman     candlepin   katello
34         '6.0.8': ('1.6.0.53', '0.9.23', '1.5.0'),
35         '6.1.1': ('1.7.2.33', '0.9.49.3', '2.2.0.14'),
36         '6.1.2': ('1.7.2.36', '0.9.49.6', '2.2.0.16'),
37         '6.1.3': ('1.7.2.43', '0.9.49.8', '2.2.0.16'),
38         '6.1.4': ('1.7.2.46', '0.9.49.9', '2.2.0.16'),
39         '6.1.5': ('1.7.2.49', '0.9.49.9', '2.2.0.16'),
40         '6.1.6': ('1.7.2.50', '0.9.49.9', '2.2.0.17'),
41         '6.1.7': ('1.7.2.53', '0.9.49.11', '2.2.0.17'),
42         '6.1.8': ('1.7.2.55', '0.9.49.12', '2.2.0.19'),
43         '6.1.9': ('1.7.2.56', '0.9.49.12', '2.2.0.19'),
44         '6.1.10': ('1.7.2.61', '0.9.49.16', '2.2.0.19'),
45         '6.1.11': ('1.7.2.62', '0.9.49.19', '2.2.0.19'),
46         '6.1.12': ('1.7.2.63', '0.9.49.23', '2.2.0.19'),
47 }
48 
49 
50 def _parse_sat_version(version):
51     ver_sp = version.split(".") if version else []
52     major = int(ver_sp[0]) if ver_sp and ver_sp[0].isdigit() else None
53     minor = int(ver_sp[1]) if len(ver_sp) > 1 and ver_sp[1].isdigit() else None
54     return [major, minor]
55 
56 
57 @combiner(InstalledRpms, optional=[Sat6Ver])
58 class SatelliteVersion(object):
59     """
60     Check the parsers
61     :class:`insights.parsers.satellite_version.Satellite6Version` and
62     :class:`insights.parsers.installed_rpms.InstalledRpms` for satellite version
63     information.
64 
65     Below is the logic to determine the satellite version::
66 
67         1. For Satellite 6.1:
68 
69             a. Check the version information in below files at first
70                - https://access.redhat.com/solutions/1392633
71                File: /usr/share/foreman/lib/satellite/version.rb
72 
73             b. Check the version of package foreman, candlepin and katello, E.g.
74                - https://access.redhat.com/articles/1343683
75 
76                             Sat 6.0.8   Sat 6.1.10  Sat 6.1.11
77                foreman      1.6.0.53    1.7.2.61    1.7.2.62
78                candlepin    0.9.23      0.9.49.16   0.9.49.19
79                katello      1.5.0       2.2.0       2.2.0
80 
81         2. For Satellite 6.2 and newer:
82 
83            Check the version of satellite package directly:
84            - https://access.redhat.com/solutions/1392633
85 
86                                     Sat 6.0.x   Sat 6.1.x   Sat 6.2.x
87                 satellite           -           -           6.2.x
88 
89         3. For Satellite 5.x
90            - https://access.redhat.com/solutions/1224043
91              NOTE: Because of satellite-branding is not deployed in Satellite
92                    5.0~5.2, and satellite-schema can also be used for checking
93                    the version, here checked satellite-schema instead of
94                    satellite-branding.
95 
96            Check the version of package satellite-schema directly:
97 
98                                         Sat 5.0~5.2     Sat 5.3 ~
99                 rhn-satellite-schema    ok              -
100                 satellite-schema        -               ok
101 
102     Attributes:
103         full(str): the full version format like `version-release`.
104         version(str): the satellite version do not includes `release`.
105         release(str): the `release` string in the version.
106         major(int): the major version.
107         minor(int): the minor version.
108 
109     Raises:
110         SkipComponent: When it's not a Satellite machine or the Satellite
111             version cannot be determined according to current information.
112 
113     Examples:
114         >>> sat_ver.full == 'satellite-6.2.0.11-1.el7sat'
115         True
116         >>> sat_ver.major
117         6
118         >>> sat_ver.minor
119         2
120         >>> sat_ver.version
121         '6.2.0.11'
122         >>> sat_ver.release
123         '1.el7sat'
124     """
125     def __init__(self, rpms, sat6_ver):
126         self.full = None
127         self.version = None
128         self.release = None
129         self.major = None
130         self.minor = None
131 
132         # For Satellite 6.1, if satellite_version/version.rb is available:
133         if sat6_ver:
134             # no 'release' in this case, but more accurate
135             self.full = sat6_ver.full
136             self.version = sat6_ver.version
137             self.major = sat6_ver.major
138             self.minor = sat6_ver.minor
139         else:
140             # For Satellite 6.2 and newer, check the satellite package directly
141             sat62_pkg = rpms.get_max('satellite')
142             if sat62_pkg:
143                 self.full = sat62_pkg.package
144                 self.version = sat62_pkg.version
145                 self.release = sat62_pkg.release
146                 self.major, self.minor = _parse_sat_version(self.version)
147             else:
148                 # For Satellite 6.0/6.1, check the version of:
149                 # - foreman, candlepin and katello
150                 fman = rpms.get_max('foreman')
151                 cndp = rpms.get_max('candlepin')
152                 ktlo = rpms.get_max('katello')
153                 if fman and cndp and ktlo:
154                     for sat_ver, map_ver in sat6_ver_map.items():
155                         if all(pkg.version.startswith(mv) for pkg, mv in zip([fman, cndp, ktlo], map_ver)):
156                             # no 'release' in this situation
157                             self.major, self.minor = _parse_sat_version(sat_ver)
158                             self.full = self.version = sat_ver
159                 else:
160                     # For Satellite 5.x
161                     sat5_pkg = rpms.get_max('satellite-schema') or rpms.get_max('rhn-satellite-schema')
162                     if sat5_pkg:
163                         self.full = sat5_pkg.package
164                         self.version = sat5_pkg.version
165                         self.release = sat5_pkg.release
166                         self.major, self.minor = _parse_sat_version(self.version)
167         if not self.full:
168             raise SkipComponent("Not a Satellite machine or unable to determine Satellite version")
169 
170 
171 @combiner(InstalledRpms)
172 class CapsuleVersion(object):
173     """
174     Check the parser
175     :class:`insights.parsers.installed_rpms.InstalledRpms` for satellite capsule
176     version information.
177 
178     .. note::
179         ONLY Satellite Capsule 6.2 and newer are supported.
180 
181     Below is the logic to determine the satellite version::
182 
183         Check the version of satellite/satellite-capsule directly:
184         - https://access.redhat.com/solutions/1392633
185 
186                                 Sat 6.0.x   Sat 6.1.x   Sat 6.2.x
187             satellite-capsule   -           -           6.2.x
188 
189     Attributes:
190         full(str): the full version format like `version-release`.
191         version(str): the satellite version do not includes `release`.
192         release(str): the `release` string in the version.
193         major(int): the major version.
194         minor(int): the minor version.
195 
196     Raises:
197         SkipComponent: When it's not a Satellite Capsule machine or the
198             Satellite Capsule version cannot be determined according to
199             current information.
200 
201     Examples:
202         >>> cap_ver.full == 'satellite-capsule-6.2.0.11-1.el7sat'
203         True
204         >>> cap_ver.major
205         6
206         >>> cap_ver.minor
207         2
208         >>> cap_ver.version
209         '6.2.0.11'
210         >>> cap_ver.release
211         '1.el7sat'
212     """
213     def __init__(self, rpms):
214         self.full = None
215         self.version = None
216         self.release = None
217         self.major = None
218         self.minor = None
219 
220         # For Capsule, ONLY 6.2 and newer are supported
221         sat62_pkg = rpms.get_max('satellite-capsule')
222         if sat62_pkg:
223             self.full = sat62_pkg.package
224             self.version = sat62_pkg.version
225             self.release = sat62_pkg.release
226             self.major, self.minor = _parse_sat_version(self.version)
227         else:
228             raise SkipComponent("Not a Satellite Capsule machine or unable to determine the version")
229
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/insights/combiners/satellite_version.py b/insights/combiners/satellite_version.py
--- a/insights/combiners/satellite_version.py
+++ b/insights/combiners/satellite_version.py
@@ -219,7 +219,8 @@
 
         # For Capsule, ONLY 6.2 and newer are supported
         sat62_pkg = rpms.get_max('satellite-capsule')
-        if sat62_pkg:
+        # foreman package should not be there on Capsule Server
+        if sat62_pkg and 'foreman' not in rpms:
             self.full = sat62_pkg.package
             self.version = sat62_pkg.version
             self.release = sat62_pkg.release

{"golden_diff": "diff --git a/insights/combiners/satellite_version.py b/insights/combiners/satellite_version.py\n--- a/insights/combiners/satellite_version.py\n+++ b/insights/combiners/satellite_version.py\n@@ -219,7 +219,8 @@\n \n         # For Capsule, ONLY 6.2 and newer are supported\n         sat62_pkg = rpms.get_max('satellite-capsule')\n-        if sat62_pkg:\n+        # foreman package should not be there on Capsule Server\n+        if sat62_pkg and 'foreman' not in rpms:\n             self.full = sat62_pkg.package\n             self.version = sat62_pkg.version\n             self.release = sat62_pkg.release\n", "issue": "Double Check satellite_version.CapsuleVersion Combiner\nCapsuleVersion Combiner currently relies on satellite-capsule package.\r\n\r\nsatellite-capsule package can be installed on satellite server t0o and plugin rules may use the combiner to wrongly identify satellite server as capsule.\r\n\r\n\"foreman\" package would not be there on Capsule server and hence can be added as a check. \n", "before_files": [{"content": "\"\"\"\nSatellite Version\n=================\n\nThe following modules are included:\n\nSatelliteVersion - Version of Satellite Server\n----------------------------------------------\nCombiner to get Satellite Server version information.\n\nCapsuleVersion - Version of Satellite Capsule (>=6.2)\n-----------------------------------------------------\nCombiner to get Satellite Capsule version information. ONLY Satellite Capsule\n6.2 and newer are supported.\n\n\n\"\"\"\n\nfrom insights import combiner, SkipComponent\nfrom insights.parsers.satellite_version import Satellite6Version as Sat6Ver\nfrom insights.parsers.installed_rpms import InstalledRpms\n\n\n# NOTE:\n# The following table only tracks 6.0.x and 6.1.x.\n# See https://access.redhat.com/articles/1343683\n# But, there are some mistakes in the KCS, the versions in below map\n# are corrected according to the corresponding ERRATA pages.\n#\n# Update: Thu Nov 14 10:51:19 CST 2019\n#\nsat6_ver_map = {\n        # Sat     foreman     candlepin   katello\n        '6.0.8': ('1.6.0.53', '0.9.23', '1.5.0'),\n        '6.1.1': ('1.7.2.33', '0.9.49.3', '2.2.0.14'),\n        '6.1.2': ('1.7.2.36', '0.9.49.6', '2.2.0.16'),\n        '6.1.3': ('1.7.2.43', '0.9.49.8', '2.2.0.16'),\n        '6.1.4': ('1.7.2.46', '0.9.49.9', '2.2.0.16'),\n        '6.1.5': ('1.7.2.49', '0.9.49.9', '2.2.0.16'),\n        '6.1.6': ('1.7.2.50', '0.9.49.9', '2.2.0.17'),\n        '6.1.7': ('1.7.2.53', '0.9.49.11', '2.2.0.17'),\n        '6.1.8': ('1.7.2.55', '0.9.49.12', '2.2.0.19'),\n        '6.1.9': ('1.7.2.56', '0.9.49.12', '2.2.0.19'),\n        '6.1.10': ('1.7.2.61', '0.9.49.16', '2.2.0.19'),\n        '6.1.11': ('1.7.2.62', '0.9.49.19', '2.2.0.19'),\n        '6.1.12': ('1.7.2.63', '0.9.49.23', '2.2.0.19'),\n}\n\n\ndef _parse_sat_version(version):\n    ver_sp = version.split(\".\") if version else []\n    major = int(ver_sp[0]) if ver_sp and ver_sp[0].isdigit() else None\n    minor = int(ver_sp[1]) if len(ver_sp) > 1 and ver_sp[1].isdigit() else None\n    return [major, minor]\n\n\n@combiner(InstalledRpms, optional=[Sat6Ver])\nclass SatelliteVersion(object):\n    \"\"\"\n    Check the parsers\n    :class:`insights.parsers.satellite_version.Satellite6Version` and\n    :class:`insights.parsers.installed_rpms.InstalledRpms` for satellite version\n    information.\n\n    Below is the logic to determine the satellite version::\n\n        1. For Satellite 6.1:\n\n            a. Check the version information in below files at first\n               - https://access.redhat.com/solutions/1392633\n               File: /usr/share/foreman/lib/satellite/version.rb\n\n            b. Check the version of package foreman, candlepin and katello, E.g.\n               - https://access.redhat.com/articles/1343683\n\n                            Sat 6.0.8   Sat 6.1.10  Sat 6.1.11\n               foreman      1.6.0.53    1.7.2.61    1.7.2.62\n               candlepin    0.9.23      0.9.49.16   0.9.49.19\n               katello      1.5.0       2.2.0       2.2.0\n\n        2. For Satellite 6.2 and newer:\n\n           Check the version of satellite package directly:\n           - https://access.redhat.com/solutions/1392633\n\n                                    Sat 6.0.x   Sat 6.1.x   Sat 6.2.x\n                satellite           -           -           6.2.x\n\n        3. For Satellite 5.x\n           - https://access.redhat.com/solutions/1224043\n             NOTE: Because of satellite-branding is not deployed in Satellite\n                   5.0~5.2, and satellite-schema can also be used for checking\n                   the version, here checked satellite-schema instead of\n                   satellite-branding.\n\n           Check the version of package satellite-schema directly:\n\n                                        Sat 5.0~5.2     Sat 5.3 ~\n                rhn-satellite-schema    ok              -\n                satellite-schema        -               ok\n\n    Attributes:\n        full(str): the full version format like `version-release`.\n        version(str): the satellite version do not includes `release`.\n        release(str): the `release` string in the version.\n        major(int): the major version.\n        minor(int): the minor version.\n\n    Raises:\n        SkipComponent: When it's not a Satellite machine or the Satellite\n            version cannot be determined according to current information.\n\n    Examples:\n        >>> sat_ver.full == 'satellite-6.2.0.11-1.el7sat'\n        True\n        >>> sat_ver.major\n        6\n        >>> sat_ver.minor\n        2\n        >>> sat_ver.version\n        '6.2.0.11'\n        >>> sat_ver.release\n        '1.el7sat'\n    \"\"\"\n    def __init__(self, rpms, sat6_ver):\n        self.full = None\n        self.version = None\n        self.release = None\n        self.major = None\n        self.minor = None\n\n        # For Satellite 6.1, if satellite_version/version.rb is available:\n        if sat6_ver:\n            # no 'release' in this case, but more accurate\n            self.full = sat6_ver.full\n            self.version = sat6_ver.version\n            self.major = sat6_ver.major\n            self.minor = sat6_ver.minor\n        else:\n            # For Satellite 6.2 and newer, check the satellite package directly\n            sat62_pkg = rpms.get_max('satellite')\n            if sat62_pkg:\n                self.full = sat62_pkg.package\n                self.version = sat62_pkg.version\n                self.release = sat62_pkg.release\n                self.major, self.minor = _parse_sat_version(self.version)\n            else:\n                # For Satellite 6.0/6.1, check the version of:\n                # - foreman, candlepin and katello\n                fman = rpms.get_max('foreman')\n                cndp = rpms.get_max('candlepin')\n                ktlo = rpms.get_max('katello')\n                if fman and cndp and ktlo:\n                    for sat_ver, map_ver in sat6_ver_map.items():\n                        if all(pkg.version.startswith(mv) for pkg, mv in zip([fman, cndp, ktlo], map_ver)):\n                            # no 'release' in this situation\n                            self.major, self.minor = _parse_sat_version(sat_ver)\n                            self.full = self.version = sat_ver\n                else:\n                    # For Satellite 5.x\n                    sat5_pkg = rpms.get_max('satellite-schema') or rpms.get_max('rhn-satellite-schema')\n                    if sat5_pkg:\n                        self.full = sat5_pkg.package\n                        self.version = sat5_pkg.version\n                        self.release = sat5_pkg.release\n                        self.major, self.minor = _parse_sat_version(self.version)\n        if not self.full:\n            raise SkipComponent(\"Not a Satellite machine or unable to determine Satellite version\")\n\n\n@combiner(InstalledRpms)\nclass CapsuleVersion(object):\n    \"\"\"\n    Check the parser\n    :class:`insights.parsers.installed_rpms.InstalledRpms` for satellite capsule\n    version information.\n\n    .. note::\n        ONLY Satellite Capsule 6.2 and newer are supported.\n\n    Below is the logic to determine the satellite version::\n\n        Check the version of satellite/satellite-capsule directly:\n        - https://access.redhat.com/solutions/1392633\n\n                                Sat 6.0.x   Sat 6.1.x   Sat 6.2.x\n            satellite-capsule   -           -           6.2.x\n\n    Attributes:\n        full(str): the full version format like `version-release`.\n        version(str): the satellite version do not includes `release`.\n        release(str): the `release` string in the version.\n        major(int): the major version.\n        minor(int): the minor version.\n\n    Raises:\n        SkipComponent: When it's not a Satellite Capsule machine or the\n            Satellite Capsule version cannot be determined according to\n            current information.\n\n    Examples:\n        >>> cap_ver.full == 'satellite-capsule-6.2.0.11-1.el7sat'\n        True\n        >>> cap_ver.major\n        6\n        >>> cap_ver.minor\n        2\n        >>> cap_ver.version\n        '6.2.0.11'\n        >>> cap_ver.release\n        '1.el7sat'\n    \"\"\"\n    def __init__(self, rpms):\n        self.full = None\n        self.version = None\n        self.release = None\n        self.major = None\n        self.minor = None\n\n        # For Capsule, ONLY 6.2 and newer are supported\n        sat62_pkg = rpms.get_max('satellite-capsule')\n        if sat62_pkg:\n            self.full = sat62_pkg.package\n            self.version = sat62_pkg.version\n            self.release = sat62_pkg.release\n            self.major, self.minor = _parse_sat_version(self.version)\n        else:\n            raise SkipComponent(\"Not a Satellite Capsule machine or unable to determine the version\")\n", "path": "insights/combiners/satellite_version.py"}], "after_files": [{"content": "\"\"\"\nSatellite Version\n=================\n\nThe following modules are included:\n\nSatelliteVersion - Version of Satellite Server\n----------------------------------------------\nCombiner to get Satellite Server version information.\n\nCapsuleVersion - Version of Satellite Capsule (>=6.2)\n-----------------------------------------------------\nCombiner to get Satellite Capsule version information. ONLY Satellite Capsule\n6.2 and newer are supported.\n\n\n\"\"\"\n\nfrom insights import combiner, SkipComponent\nfrom insights.parsers.satellite_version import Satellite6Version as Sat6Ver\nfrom insights.parsers.installed_rpms import InstalledRpms\n\n\n# NOTE:\n# The following table only tracks 6.0.x and 6.1.x.\n# See https://access.redhat.com/articles/1343683\n# But, there are some mistakes in the KCS, the versions in below map\n# are corrected according to the corresponding ERRATA pages.\n#\n# Update: Thu Nov 14 10:51:19 CST 2019\n#\nsat6_ver_map = {\n        # Sat     foreman     candlepin   katello\n        '6.0.8': ('1.6.0.53', '0.9.23', '1.5.0'),\n        '6.1.1': ('1.7.2.33', '0.9.49.3', '2.2.0.14'),\n        '6.1.2': ('1.7.2.36', '0.9.49.6', '2.2.0.16'),\n        '6.1.3': ('1.7.2.43', '0.9.49.8', '2.2.0.16'),\n        '6.1.4': ('1.7.2.46', '0.9.49.9', '2.2.0.16'),\n        '6.1.5': ('1.7.2.49', '0.9.49.9', '2.2.0.16'),\n        '6.1.6': ('1.7.2.50', '0.9.49.9', '2.2.0.17'),\n        '6.1.7': ('1.7.2.53', '0.9.49.11', '2.2.0.17'),\n        '6.1.8': ('1.7.2.55', '0.9.49.12', '2.2.0.19'),\n        '6.1.9': ('1.7.2.56', '0.9.49.12', '2.2.0.19'),\n        '6.1.10': ('1.7.2.61', '0.9.49.16', '2.2.0.19'),\n        '6.1.11': ('1.7.2.62', '0.9.49.19', '2.2.0.19'),\n        '6.1.12': ('1.7.2.63', '0.9.49.23', '2.2.0.19'),\n}\n\n\ndef _parse_sat_version(version):\n    ver_sp = version.split(\".\") if version else []\n    major = int(ver_sp[0]) if ver_sp and ver_sp[0].isdigit() else None\n    minor = int(ver_sp[1]) if len(ver_sp) > 1 and ver_sp[1].isdigit() else None\n    return [major, minor]\n\n\n@combiner(InstalledRpms, optional=[Sat6Ver])\nclass SatelliteVersion(object):\n    \"\"\"\n    Check the parsers\n    :class:`insights.parsers.satellite_version.Satellite6Version` and\n    :class:`insights.parsers.installed_rpms.InstalledRpms` for satellite version\n    information.\n\n    Below is the logic to determine the satellite version::\n\n        1. For Satellite 6.1:\n\n            a. Check the version information in below files at first\n               - https://access.redhat.com/solutions/1392633\n               File: /usr/share/foreman/lib/satellite/version.rb\n\n            b. Check the version of package foreman, candlepin and katello, E.g.\n               - https://access.redhat.com/articles/1343683\n\n                            Sat 6.0.8   Sat 6.1.10  Sat 6.1.11\n               foreman      1.6.0.53    1.7.2.61    1.7.2.62\n               candlepin    0.9.23      0.9.49.16   0.9.49.19\n               katello      1.5.0       2.2.0       2.2.0\n\n        2. For Satellite 6.2 and newer:\n\n           Check the version of satellite package directly:\n           - https://access.redhat.com/solutions/1392633\n\n                                    Sat 6.0.x   Sat 6.1.x   Sat 6.2.x\n                satellite           -           -           6.2.x\n\n        3. For Satellite 5.x\n           - https://access.redhat.com/solutions/1224043\n             NOTE: Because of satellite-branding is not deployed in Satellite\n                   5.0~5.2, and satellite-schema can also be used for checking\n                   the version, here checked satellite-schema instead of\n                   satellite-branding.\n\n           Check the version of package satellite-schema directly:\n\n                                        Sat 5.0~5.2     Sat 5.3 ~\n                rhn-satellite-schema    ok              -\n                satellite-schema        -               ok\n\n    Attributes:\n        full(str): the full version format like `version-release`.\n        version(str): the satellite version do not includes `release`.\n        release(str): the `release` string in the version.\n        major(int): the major version.\n        minor(int): the minor version.\n\n    Raises:\n        SkipComponent: When it's not a Satellite machine or the Satellite\n            version cannot be determined according to current information.\n\n    Examples:\n        >>> sat_ver.full == 'satellite-6.2.0.11-1.el7sat'\n        True\n        >>> sat_ver.major\n        6\n        >>> sat_ver.minor\n        2\n        >>> sat_ver.version\n        '6.2.0.11'\n        >>> sat_ver.release\n        '1.el7sat'\n    \"\"\"\n    def __init__(self, rpms, sat6_ver):\n        self.full = None\n        self.version = None\n        self.release = None\n        self.major = None\n        self.minor = None\n\n        # For Satellite 6.1, if satellite_version/version.rb is available:\n        if sat6_ver:\n            # no 'release' in this case, but more accurate\n            self.full = sat6_ver.full\n            self.version = sat6_ver.version\n            self.major = sat6_ver.major\n            self.minor = sat6_ver.minor\n        else:\n            # For Satellite 6.2 and newer, check the satellite package directly\n            sat62_pkg = rpms.get_max('satellite')\n            if sat62_pkg:\n                self.full = sat62_pkg.package\n                self.version = sat62_pkg.version\n                self.release = sat62_pkg.release\n                self.major, self.minor = _parse_sat_version(self.version)\n            else:\n                # For Satellite 6.0/6.1, check the version of:\n                # - foreman, candlepin and katello\n                fman = rpms.get_max('foreman')\n                cndp = rpms.get_max('candlepin')\n                ktlo = rpms.get_max('katello')\n                if fman and cndp and ktlo:\n                    for sat_ver, map_ver in sat6_ver_map.items():\n                        if all(pkg.version.startswith(mv) for pkg, mv in zip([fman, cndp, ktlo], map_ver)):\n                            # no 'release' in this situation\n                            self.major, self.minor = _parse_sat_version(sat_ver)\n                            self.full = self.version = sat_ver\n                else:\n                    # For Satellite 5.x\n                    sat5_pkg = rpms.get_max('satellite-schema') or rpms.get_max('rhn-satellite-schema')\n                    if sat5_pkg:\n                        self.full = sat5_pkg.package\n                        self.version = sat5_pkg.version\n                        self.release = sat5_pkg.release\n                        self.major, self.minor = _parse_sat_version(self.version)\n        if not self.full:\n            raise SkipComponent(\"Not a Satellite machine or unable to determine Satellite version\")\n\n\n@combiner(InstalledRpms)\nclass CapsuleVersion(object):\n    \"\"\"\n    Check the parser\n    :class:`insights.parsers.installed_rpms.InstalledRpms` for satellite capsule\n    version information.\n\n    .. note::\n        ONLY Satellite Capsule 6.2 and newer are supported.\n\n    Below is the logic to determine the satellite version::\n\n        Check the version of satellite/satellite-capsule directly:\n        - https://access.redhat.com/solutions/1392633\n\n                                Sat 6.0.x   Sat 6.1.x   Sat 6.2.x\n            satellite-capsule   -           -           6.2.x\n\n    Attributes:\n        full(str): the full version format like `version-release`.\n        version(str): the satellite version do not includes `release`.\n        release(str): the `release` string in the version.\n        major(int): the major version.\n        minor(int): the minor version.\n\n    Raises:\n        SkipComponent: When it's not a Satellite Capsule machine or the\n            Satellite Capsule version cannot be determined according to\n            current information.\n\n    Examples:\n        >>> cap_ver.full == 'satellite-capsule-6.2.0.11-1.el7sat'\n        True\n        >>> cap_ver.major\n        6\n        >>> cap_ver.minor\n        2\n        >>> cap_ver.version\n        '6.2.0.11'\n        >>> cap_ver.release\n        '1.el7sat'\n    \"\"\"\n    def __init__(self, rpms):\n        self.full = None\n        self.version = None\n        self.release = None\n        self.major = None\n        self.minor = None\n\n        # For Capsule, ONLY 6.2 and newer are supported\n        sat62_pkg = rpms.get_max('satellite-capsule')\n        # foreman package should not be there on Capsule Server\n        if sat62_pkg and 'foreman' not in rpms:\n            self.full = sat62_pkg.package\n            self.version = sat62_pkg.version\n            self.release = sat62_pkg.release\n            self.major, self.minor = _parse_sat_version(self.version)\n        else:\n            raise SkipComponent(\"Not a Satellite Capsule machine or unable to determine the version\")\n", "path": "insights/combiners/satellite_version.py"}]}