We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
YumRepolist parser throws an exception parsing valid repolist data
The [YumRepolist parser](https://github.com/RedHatInsights/insights-core/blob/master/insights/parsers/yum.py) throws an exception when attempting to parse valid output:

```
$ insights inspect insights.combiners.cloud_provider.CloudProvider archive
Traceback (most recent call last):
  File "/home/bfahr/work/insights/insights-core/insights/core/dr.py", line 962, in run
    result = DELEGATES[component].process(broker)
  File "/home/bfahr/work/insights/insights-core/insights/core/dr.py", line 681, in process
    return self.invoke(broker)
  File "/home/bfahr/work/insights/insights-core/insights/core/plugins.py", line 130, in invoke
    return self.component(dep_value)
  File "/home/bfahr/work/insights/insights-core/insights/core/__init__.py", line 598, in __init__
    super(CommandParser, self).__init__(context)
  File "/home/bfahr/work/insights/insights-core/insights/core/__init__.py", line 92, in __init__
    self._handle_content(context)
  File "/home/bfahr/work/insights/insights-core/insights/core/__init__.py", line 95, in _handle_content
    self.parse_content(context.content)
  File "/home/bfahr/work/insights/insights-core/insights/parsers/yum.py", line 145, in parse_content
    empty_exception=True)
  File "/home/bfahr/work/insights/insights-core/insights/parsers/__init__.py", line 342, in parse_fixed_table
    first_line = calc_offset(table_lines, heading_ignore)
  File "/home/bfahr/work/insights/insights-core/insights/parsers/__init__.py", line 276, in calc_offset
    raise ValueError("Line containing '{}' was not found in table".format(','.join(target)))
ValueError: Line containing 'repo id' was not found in table
```

Caused by output of `yum -C --noplugins repolist` having the output:

```
repolist: 0
```

--- 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/parsers/yum.py`
Content:
```
1 """
2 Yum - Commands
3 ==============
4 Parsers for ``yum`` commands.
5 
6 This module contains the classes that parse the output of the commands
7 `yum -C --noplugins repolist`.
8 
9 YumRepoList - command ``yum -C --noplugins repolist``
10 -----------------------------------------------------
11 """
12 
13 from insights import parser, CommandParser
14 from insights.parsers import SkipException, parse_fixed_table
15 from insights.specs import Specs
16 
17 eus = [
18     '5.0.z',
19     '5.1.z',
20     '5.2.z',
21     '5.3.ll',
22     '5.3.z',
23     '5.4.z',
24     '5.6.ll',
25     '5.6.z',
26     '5.9.ll',
27     '5.9.z'
28     '6.0.z',
29     '6.1.z',
30     '6.2.aus',
31     '6.2.z',
32     '6.3.z',
33     '6.4.aus',
34     '6.4.z',
35     '6.5.aus',
36     '6.5.z',
37     '6.6.aus',
38     '6.6.z',
39     '6.7.z'
40 ]
41 
42 
43 @parser(Specs.yum_repolist)
44 class YumRepoList(CommandParser):
45     """
46     Class for parsing the output of `yum -C --noplugins repolist` command.
47 
48     Typical output of the command is::
49 
50         repo id                                             repo name                                                                                                    status
51         rhel-7-server-e4s-rpms/x86_64                       Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)                                 12,250
52         !rhel-ha-for-rhel-7-server-e4s-rpms/x86_64          Red Hat Enterprise Linux High Availability (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)         272
53         *rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64    RHEL for SAP HANA (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)                                   21
54         repolist: 12,768
55 
56     Or sometimes it just outputs repo id and status::
57 
58         repo id                                                                               status
59         LME_EPEL_6_x86_64                                                                        26123
60         LME_FSMLabs_Timekeeper_timekeeper                                                            2
61         LME_HP_-_Software_Delivery_Repository_Firmware_Pack_for_ProLiant_-_6Server_-_Current      1163
62         LME_HP_-_Software_Delivery_Repository_Scripting_Took_Kit_-_6Server                          17
63         LME_HP_-_Software_Delivery_Repository_Service_Pack_for_ProLiant_-_6Server_-_Current       1915
64         LME_HP_-_Software_Delivery_Repository_Smart_Update_Manager_-_6Server                        30
65         LME_LME_Custom_Product_Mellanox_OFED                                                       114
66         LME_LME_Custom_Product_OMD_RPMS                                                             14
67         LME_LME_Custom_Product_RPMs                                                                  5
68         LME_LME_Custom_Product_SNOW_Repository                                                       2
69         rhel-6-server-optional-rpms                                                            10400+1
70         rhel-6-server-rpms                                                                    18256+12
71         rhel-6-server-satellite-tools-6.2-rpms                                                      55
72         repolist: 58096
73 
74     Examples:
75         >>> len(repolist)
76         3
77         >>> 'rhel-7-server-e4s-rpms/x86_64' in repolist.repos
78         True
79         >>> 'rhel-7-server-e4s-rpms' in repolist.repos
80         False
81         >>> 'rhel-7-server-e4s-rpms' in repolist.rhel_repos
82         True
83         >>> repolist['rhel-7-server-e4s-rpms/x86_64']['name']
84         'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)'
85         >>> repolist[0]['name']
86         'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)'
87         >>> repolist['rhel-ha-for-rhel-7-server-e4s-rpms/x86_64']['id']
88         '!rhel-ha-for-rhel-7-server-e4s-rpms/x86_64'
89         >>> len(repolist_no_reponame)
90         13
91         >>> len(repolist_no_reponame.rhel_repos)
92         3
93         >>> 'rhel-6-server-rpms' in repolist_no_reponame.repos
94         True
95         >>> 'rhel-6-server-optional-rpms' in repolist_no_reponame.rhel_repos
96         True
97         >>> repolist_no_reponame[0]['id']
98         'LME_EPEL_6_x86_64'
99         >>> repolist_no_reponame[0].get('name', '')
100         ''
101 
102     Attributes:
103         data (list): list of repos wrapped in dictionaries
104         repos (dict): dict of all listed repos where the key is the full repo-id without "!" or "*".
105             But you can get it from the value part if needed. For example::
106 
107                 self.repos = {
108                     'rhel-7-server-e4s-rpms/x86_64': {
109                         'id': 'rhel-7-server-e4s-rpms/x86_64',
110                         'name': 'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)',
111                         'status': '12,250'
112                     },
113                     'rhel-ha-for-rhel-7-server-e4s-rpms/x86_64': {
114                         'id': '!rhel-ha-for-rhel-7-server-e4s-rpms/x86_64',
115                         'name': 'Red Hat Enterprise Linux High Availability (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)',
116                         'status': '272'
117                     },
118                     'rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64': {
119                         'id': '*rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64',
120                         'name': 'RHEL for SAP HANA (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)',
121                         'status': '21'
122                     }
123                 }
124 
125     """
126     def parse_content(self, content):
127         if not content:
128             raise SkipException('No repolist.')
129 
130         trailing_line_prefix = [
131                 'repolist:',
132                 'Uploading Enabled',
133                 'Loaded plugins:',
134                 'Plugin ',
135                 'Unable to upload',
136         ]
137 
138         self.data = []
139         self.repos = {}
140         self.data = parse_fixed_table(
141                 content,
142                 heading_ignore=['repo id'],
143                 header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],
144                 trailing_ignore=trailing_line_prefix,
145                 empty_exception=True)
146 
147         if not self.data:
148             raise SkipException('No repolist.')
149 
150         self.repos = dict((d['id'].lstrip('!').lstrip('*'), d) for d in self.data)
151 
152     def __len__(self):
153         return len(self.data)
154 
155     def __getitem__(self, idx):
156         if isinstance(idx, int):
157             return self.data[idx]
158         elif isinstance(idx, str):
159             return self.repos[idx]
160 
161     def __contains__(self, _id):
162         return _id in self.repos
163 
164     @property
165     def eus(self):
166         '''list of the EUS part of each repo'''
167         euses = []
168         for repo in [r["id"] for r in self.data]:
169             if repo.startswith("rhel-") and "server-" in repo:
170                 _, eus_version = repo.split("server-", 1)
171                 if eus_version in eus:
172                     euses.append(eus_version)
173         return euses
174 
175     @property
176     def rhel_repos(self):
177         """
178         list: list of all the rhel repos and the item is just the repo id without server and arch info.
179             For example::
180 
181                 self.rhel_repos = [
182                     'rhel-7-server-e4s-rpms',
183                     'rhel-ha-for-rhel-7-server-e4s-rpms',
184                     'rhel-sap-hana-for-rhel-7-server-e4s-rpms'
185                 ]
186         """
187         return [i.split('/')[0]
188                 for i in self.repos
189                 if i.startswith('rhel-') or '-rhel-' in i]
190
```
--- 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/parsers/yum.py b/insights/parsers/yum.py
--- a/insights/parsers/yum.py
+++ b/insights/parsers/yum.py
@@ -11,7 +11,7 @@
 """
 
 from insights import parser, CommandParser
-from insights.parsers import SkipException, parse_fixed_table
+from insights.parsers import SkipException, parse_fixed_table, ParseException
 from insights.specs import Specs
 
 eus = [
@@ -127,6 +127,9 @@
         if not content:
             raise SkipException('No repolist.')
 
+        if content[0].startswith('repolist:'):
+            raise SkipException('No repolist.')
+
         trailing_line_prefix = [
                 'repolist:',
                 'Uploading Enabled',
@@ -137,12 +140,16 @@
 
         self.data = []
         self.repos = {}
-        self.data = parse_fixed_table(
-                content,
-                heading_ignore=['repo id'],
-                header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],
-                trailing_ignore=trailing_line_prefix,
-                empty_exception=True)
+        try:
+            self.data = parse_fixed_table(
+                    content,
+                    heading_ignore=['repo id'],
+                    header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],
+                    trailing_ignore=trailing_line_prefix,
+                    empty_exception=True)
+        except ValueError as e:
+            # ValueError raised by parse_fixed_table
+            raise ParseException('Failed to parser yum repolist: {0}'.format(str(e)))
 
         if not self.data:
             raise SkipException('No repolist.')

{"golden_diff": "diff --git a/insights/parsers/yum.py b/insights/parsers/yum.py\n--- a/insights/parsers/yum.py\n+++ b/insights/parsers/yum.py\n@@ -11,7 +11,7 @@\n \"\"\"\n \n from insights import parser, CommandParser\n-from insights.parsers import SkipException, parse_fixed_table\n+from insights.parsers import SkipException, parse_fixed_table, ParseException\n from insights.specs import Specs\n \n eus = [\n@@ -127,6 +127,9 @@\n         if not content:\n             raise SkipException('No repolist.')\n \n+        if content[0].startswith('repolist:'):\n+            raise SkipException('No repolist.')\n+\n         trailing_line_prefix = [\n                 'repolist:',\n                 'Uploading Enabled',\n@@ -137,12 +140,16 @@\n \n         self.data = []\n         self.repos = {}\n-        self.data = parse_fixed_table(\n-                content,\n-                heading_ignore=['repo id'],\n-                header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],\n-                trailing_ignore=trailing_line_prefix,\n-                empty_exception=True)\n+        try:\n+            self.data = parse_fixed_table(\n+                    content,\n+                    heading_ignore=['repo id'],\n+                    header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],\n+                    trailing_ignore=trailing_line_prefix,\n+                    empty_exception=True)\n+        except ValueError as e:\n+            # ValueError raised by parse_fixed_table\n+            raise ParseException('Failed to parser yum repolist: {0}'.format(str(e)))\n \n         if not self.data:\n             raise SkipException('No repolist.')\n", "issue": "YumRepolist parser throws an exception parsing valid repolist data\nThe [YumRepolist parser](https://github.com/RedHatInsights/insights-core/blob/master/insights/parsers/yum.py) throws an exception when attempting to parse valid output:\r\n\r\n```\r\n$ insights inspect insights.combiners.cloud_provider.CloudProvider archive\r\nTraceback (most recent call last):\r\n  File \"/home/bfahr/work/insights/insights-core/insights/core/dr.py\", line 962, in run\r\n    result = DELEGATES[component].process(broker)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/core/dr.py\", line 681, in process\r\n    return self.invoke(broker)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/core/plugins.py\", line 130, in invoke\r\n    return self.component(dep_value)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/core/__init__.py\", line 598, in __init__\r\n    super(CommandParser, self).__init__(context)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/core/__init__.py\", line 92, in __init__\r\n    self._handle_content(context)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/core/__init__.py\", line 95, in _handle_content\r\n    self.parse_content(context.content)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/parsers/yum.py\", line 145, in parse_content\r\n    empty_exception=True)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/parsers/__init__.py\", line 342, in parse_fixed_table\r\n    first_line = calc_offset(table_lines, heading_ignore)\r\n  File \"/home/bfahr/work/insights/insights-core/insights/parsers/__init__.py\", line 276, in calc_offset\r\n    raise ValueError(\"Line containing '{}' was not found in table\".format(','.join(target)))\r\nValueError: Line containing 'repo id' was not found in table\r\n```\r\n\r\nCaused by output of `yum -C --noplugins repolist` having the output:\r\n\r\n```\r\nrepolist: 0\r\n```\n", "before_files": [{"content": "\"\"\"\nYum - Commands\n==============\nParsers for ``yum`` commands.\n\nThis module contains the classes that parse the output of the commands\n`yum -C --noplugins repolist`.\n\nYumRepoList - command ``yum -C --noplugins repolist``\n-----------------------------------------------------\n\"\"\"\n\nfrom insights import parser, CommandParser\nfrom insights.parsers import SkipException, parse_fixed_table\nfrom insights.specs import Specs\n\neus = [\n    '5.0.z',\n    '5.1.z',\n    '5.2.z',\n    '5.3.ll',\n    '5.3.z',\n    '5.4.z',\n    '5.6.ll',\n    '5.6.z',\n    '5.9.ll',\n    '5.9.z'\n    '6.0.z',\n    '6.1.z',\n    '6.2.aus',\n    '6.2.z',\n    '6.3.z',\n    '6.4.aus',\n    '6.4.z',\n    '6.5.aus',\n    '6.5.z',\n    '6.6.aus',\n    '6.6.z',\n    '6.7.z'\n]\n\n\n@parser(Specs.yum_repolist)\nclass YumRepoList(CommandParser):\n    \"\"\"\n    Class for parsing the output of `yum -C --noplugins repolist` command.\n\n    Typical output of the command is::\n\n        repo id                                             repo name                                                                                                    status\n        rhel-7-server-e4s-rpms/x86_64                       Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)                                 12,250\n        !rhel-ha-for-rhel-7-server-e4s-rpms/x86_64          Red Hat Enterprise Linux High Availability (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)         272\n        *rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64    RHEL for SAP HANA (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)                                   21\n        repolist: 12,768\n\n    Or sometimes it just outputs repo id and status::\n\n        repo id                                                                               status\n        LME_EPEL_6_x86_64                                                                        26123\n        LME_FSMLabs_Timekeeper_timekeeper                                                            2\n        LME_HP_-_Software_Delivery_Repository_Firmware_Pack_for_ProLiant_-_6Server_-_Current      1163\n        LME_HP_-_Software_Delivery_Repository_Scripting_Took_Kit_-_6Server                          17\n        LME_HP_-_Software_Delivery_Repository_Service_Pack_for_ProLiant_-_6Server_-_Current       1915\n        LME_HP_-_Software_Delivery_Repository_Smart_Update_Manager_-_6Server                        30\n        LME_LME_Custom_Product_Mellanox_OFED                                                       114\n        LME_LME_Custom_Product_OMD_RPMS                                                             14\n        LME_LME_Custom_Product_RPMs                                                                  5\n        LME_LME_Custom_Product_SNOW_Repository                                                       2\n        rhel-6-server-optional-rpms                                                            10400+1\n        rhel-6-server-rpms                                                                    18256+12\n        rhel-6-server-satellite-tools-6.2-rpms                                                      55\n        repolist: 58096\n\n    Examples:\n        >>> len(repolist)\n        3\n        >>> 'rhel-7-server-e4s-rpms/x86_64' in repolist.repos\n        True\n        >>> 'rhel-7-server-e4s-rpms' in repolist.repos\n        False\n        >>> 'rhel-7-server-e4s-rpms' in repolist.rhel_repos\n        True\n        >>> repolist['rhel-7-server-e4s-rpms/x86_64']['name']\n        'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)'\n        >>> repolist[0]['name']\n        'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)'\n        >>> repolist['rhel-ha-for-rhel-7-server-e4s-rpms/x86_64']['id']\n        '!rhel-ha-for-rhel-7-server-e4s-rpms/x86_64'\n        >>> len(repolist_no_reponame)\n        13\n        >>> len(repolist_no_reponame.rhel_repos)\n        3\n        >>> 'rhel-6-server-rpms' in repolist_no_reponame.repos\n        True\n        >>> 'rhel-6-server-optional-rpms' in repolist_no_reponame.rhel_repos\n        True\n        >>> repolist_no_reponame[0]['id']\n        'LME_EPEL_6_x86_64'\n        >>> repolist_no_reponame[0].get('name', '')\n        ''\n\n    Attributes:\n        data (list): list of repos wrapped in dictionaries\n        repos (dict): dict of all listed repos where the key is the full repo-id without \"!\" or \"*\".\n            But you can get it from the value part if needed. For example::\n\n                self.repos = {\n                    'rhel-7-server-e4s-rpms/x86_64': {\n                        'id': 'rhel-7-server-e4s-rpms/x86_64',\n                        'name': 'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)',\n                        'status': '12,250'\n                    },\n                    'rhel-ha-for-rhel-7-server-e4s-rpms/x86_64': {\n                        'id': '!rhel-ha-for-rhel-7-server-e4s-rpms/x86_64',\n                        'name': 'Red Hat Enterprise Linux High Availability (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)',\n                        'status': '272'\n                    },\n                    'rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64': {\n                        'id': '*rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64',\n                        'name': 'RHEL for SAP HANA (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)',\n                        'status': '21'\n                    }\n                }\n\n    \"\"\"\n    def parse_content(self, content):\n        if not content:\n            raise SkipException('No repolist.')\n\n        trailing_line_prefix = [\n                'repolist:',\n                'Uploading Enabled',\n                'Loaded plugins:',\n                'Plugin ',\n                'Unable to upload',\n        ]\n\n        self.data = []\n        self.repos = {}\n        self.data = parse_fixed_table(\n                content,\n                heading_ignore=['repo id'],\n                header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],\n                trailing_ignore=trailing_line_prefix,\n                empty_exception=True)\n\n        if not self.data:\n            raise SkipException('No repolist.')\n\n        self.repos = dict((d['id'].lstrip('!').lstrip('*'), d) for d in self.data)\n\n    def __len__(self):\n        return len(self.data)\n\n    def __getitem__(self, idx):\n        if isinstance(idx, int):\n            return self.data[idx]\n        elif isinstance(idx, str):\n            return self.repos[idx]\n\n    def __contains__(self, _id):\n        return _id in self.repos\n\n    @property\n    def eus(self):\n        '''list of the EUS part of each repo'''\n        euses = []\n        for repo in [r[\"id\"] for r in self.data]:\n            if repo.startswith(\"rhel-\") and \"server-\" in repo:\n                _, eus_version = repo.split(\"server-\", 1)\n                if eus_version in eus:\n                    euses.append(eus_version)\n        return euses\n\n    @property\n    def rhel_repos(self):\n        \"\"\"\n        list: list of all the rhel repos and the item is just the repo id without server and arch info.\n            For example::\n\n                self.rhel_repos = [\n                    'rhel-7-server-e4s-rpms',\n                    'rhel-ha-for-rhel-7-server-e4s-rpms',\n                    'rhel-sap-hana-for-rhel-7-server-e4s-rpms'\n                ]\n        \"\"\"\n        return [i.split('/')[0]\n                for i in self.repos\n                if i.startswith('rhel-') or '-rhel-' in i]\n", "path": "insights/parsers/yum.py"}], "after_files": [{"content": "\"\"\"\nYum - Commands\n==============\nParsers for ``yum`` commands.\n\nThis module contains the classes that parse the output of the commands\n`yum -C --noplugins repolist`.\n\nYumRepoList - command ``yum -C --noplugins repolist``\n-----------------------------------------------------\n\"\"\"\n\nfrom insights import parser, CommandParser\nfrom insights.parsers import SkipException, parse_fixed_table, ParseException\nfrom insights.specs import Specs\n\neus = [\n    '5.0.z',\n    '5.1.z',\n    '5.2.z',\n    '5.3.ll',\n    '5.3.z',\n    '5.4.z',\n    '5.6.ll',\n    '5.6.z',\n    '5.9.ll',\n    '5.9.z'\n    '6.0.z',\n    '6.1.z',\n    '6.2.aus',\n    '6.2.z',\n    '6.3.z',\n    '6.4.aus',\n    '6.4.z',\n    '6.5.aus',\n    '6.5.z',\n    '6.6.aus',\n    '6.6.z',\n    '6.7.z'\n]\n\n\n@parser(Specs.yum_repolist)\nclass YumRepoList(CommandParser):\n    \"\"\"\n    Class for parsing the output of `yum -C --noplugins repolist` command.\n\n    Typical output of the command is::\n\n        repo id                                             repo name                                                                                                    status\n        rhel-7-server-e4s-rpms/x86_64                       Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)                                 12,250\n        !rhel-ha-for-rhel-7-server-e4s-rpms/x86_64          Red Hat Enterprise Linux High Availability (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)         272\n        *rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64    RHEL for SAP HANA (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)                                   21\n        repolist: 12,768\n\n    Or sometimes it just outputs repo id and status::\n\n        repo id                                                                               status\n        LME_EPEL_6_x86_64                                                                        26123\n        LME_FSMLabs_Timekeeper_timekeeper                                                            2\n        LME_HP_-_Software_Delivery_Repository_Firmware_Pack_for_ProLiant_-_6Server_-_Current      1163\n        LME_HP_-_Software_Delivery_Repository_Scripting_Took_Kit_-_6Server                          17\n        LME_HP_-_Software_Delivery_Repository_Service_Pack_for_ProLiant_-_6Server_-_Current       1915\n        LME_HP_-_Software_Delivery_Repository_Smart_Update_Manager_-_6Server                        30\n        LME_LME_Custom_Product_Mellanox_OFED                                                       114\n        LME_LME_Custom_Product_OMD_RPMS                                                             14\n        LME_LME_Custom_Product_RPMs                                                                  5\n        LME_LME_Custom_Product_SNOW_Repository                                                       2\n        rhel-6-server-optional-rpms                                                            10400+1\n        rhel-6-server-rpms                                                                    18256+12\n        rhel-6-server-satellite-tools-6.2-rpms                                                      55\n        repolist: 58096\n\n    Examples:\n        >>> len(repolist)\n        3\n        >>> 'rhel-7-server-e4s-rpms/x86_64' in repolist.repos\n        True\n        >>> 'rhel-7-server-e4s-rpms' in repolist.repos\n        False\n        >>> 'rhel-7-server-e4s-rpms' in repolist.rhel_repos\n        True\n        >>> repolist['rhel-7-server-e4s-rpms/x86_64']['name']\n        'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)'\n        >>> repolist[0]['name']\n        'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)'\n        >>> repolist['rhel-ha-for-rhel-7-server-e4s-rpms/x86_64']['id']\n        '!rhel-ha-for-rhel-7-server-e4s-rpms/x86_64'\n        >>> len(repolist_no_reponame)\n        13\n        >>> len(repolist_no_reponame.rhel_repos)\n        3\n        >>> 'rhel-6-server-rpms' in repolist_no_reponame.repos\n        True\n        >>> 'rhel-6-server-optional-rpms' in repolist_no_reponame.rhel_repos\n        True\n        >>> repolist_no_reponame[0]['id']\n        'LME_EPEL_6_x86_64'\n        >>> repolist_no_reponame[0].get('name', '')\n        ''\n\n    Attributes:\n        data (list): list of repos wrapped in dictionaries\n        repos (dict): dict of all listed repos where the key is the full repo-id without \"!\" or \"*\".\n            But you can get it from the value part if needed. For example::\n\n                self.repos = {\n                    'rhel-7-server-e4s-rpms/x86_64': {\n                        'id': 'rhel-7-server-e4s-rpms/x86_64',\n                        'name': 'Red Hat Enterprise Linux 7 Server - Update Services for SAP Solutions (RPMs)',\n                        'status': '12,250'\n                    },\n                    'rhel-ha-for-rhel-7-server-e4s-rpms/x86_64': {\n                        'id': '!rhel-ha-for-rhel-7-server-e4s-rpms/x86_64',\n                        'name': 'Red Hat Enterprise Linux High Availability (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)',\n                        'status': '272'\n                    },\n                    'rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64': {\n                        'id': '*rhel-sap-hana-for-rhel-7-server-e4s-rpms/x86_64',\n                        'name': 'RHEL for SAP HANA (for RHEL 7 Server) Update Services for SAP Solutions (RPMs)',\n                        'status': '21'\n                    }\n                }\n\n    \"\"\"\n    def parse_content(self, content):\n        if not content:\n            raise SkipException('No repolist.')\n\n        if content[0].startswith('repolist:'):\n            raise SkipException('No repolist.')\n\n        trailing_line_prefix = [\n                'repolist:',\n                'Uploading Enabled',\n                'Loaded plugins:',\n                'Plugin ',\n                'Unable to upload',\n        ]\n\n        self.data = []\n        self.repos = {}\n        try:\n            self.data = parse_fixed_table(\n                    content,\n                    heading_ignore=['repo id'],\n                    header_substitute=[('repo id', 'id     '), ('repo name', 'name     ')],\n                    trailing_ignore=trailing_line_prefix,\n                    empty_exception=True)\n        except ValueError as e:\n            # ValueError raised by parse_fixed_table\n            raise ParseException('Failed to parser yum repolist: {0}'.format(str(e)))\n\n        if not self.data:\n            raise SkipException('No repolist.')\n\n        self.repos = dict((d['id'].lstrip('!').lstrip('*'), d) for d in self.data)\n\n    def __len__(self):\n        return len(self.data)\n\n    def __getitem__(self, idx):\n        if isinstance(idx, int):\n            return self.data[idx]\n        elif isinstance(idx, str):\n            return self.repos[idx]\n\n    def __contains__(self, _id):\n        return _id in self.repos\n\n    @property\n    def eus(self):\n        '''list of the EUS part of each repo'''\n        euses = []\n        for repo in [r[\"id\"] for r in self.data]:\n            if repo.startswith(\"rhel-\") and \"server-\" in repo:\n                _, eus_version = repo.split(\"server-\", 1)\n                if eus_version in eus:\n                    euses.append(eus_version)\n        return euses\n\n    @property\n    def rhel_repos(self):\n        \"\"\"\n        list: list of all the rhel repos and the item is just the repo id without server and arch info.\n            For example::\n\n                self.rhel_repos = [\n                    'rhel-7-server-e4s-rpms',\n                    'rhel-ha-for-rhel-7-server-e4s-rpms',\n                    'rhel-sap-hana-for-rhel-7-server-e4s-rpms'\n                ]\n        \"\"\"\n        return [i.split('/')[0]\n                for i in self.repos\n                if i.startswith('rhel-') or '-rhel-' in i]\n", "path": "insights/parsers/yum.py"}]}