prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  SMDA* is not business SAP instances
  ~~~
  # cat insights_commands/usr.sap.hostctrl.exe.saphostctrl_-function_GetCIMObject_-enuminstances_SAPInstance
  *********************************************************
   CreationClassName , String , SAPInstance
   SID , String , SMA
   SystemNumber , String , 98
   InstanceName , String , SMDA98
   Hostname , String , li-ld-1846
   FullQualifiedHostname , String , li-ld-1846.hag.hilti.com
   SapVersionInfo , String , 749, patch 200, changelist 1746260
  ~~~
  
  From Rolf:
  > the reported instance SMDA98 is the Solution Manager agent, which the customer wants use to monitor that system [1]. With newer systems, that can alternatively also be the diagnostic agent (instance name DAA*98).
  * here is a typo, DAA should be SID name
  
  --- 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/sap.py`
  Content:
  ```
  1 """
  2 Sap - Combiner
  3 ==============
  4 
  5 This combiner gets the running SAP instances on the system based on below
  6 logic::
  7 
  8     if (SAPLOCALHOST = 'hostname') && InstanceType = D## ) then
  9         on this system runs SAP Netweaver Application Server version
  10 
  11     if (SAPLOCALHOST = 'hostname') && InstanceType = ASCS## ) then
  12         on this system runs SAP Netweaver Application Server Central Instance
  13         version
  14 
  15     if (SAPLOCALHOST = 'hostname') && InstanceType = HDB## ) then
  16         on this system runs SAP HANA database version
  17 
  18 Check settings according SAP Notes compiled here:
  19 https://wiki.scn.sap.com/wiki/x/rDK7Gg
  20 
  21 """
  22 
  23 from collections import namedtuple
  24 from insights import LegacyItemAccess
  25 from insights.parsers import SkipException
  26 from insights.core.plugins import combiner
  27 from insights.combiners.hostname import hostname
  28 from insights.parsers.lssap import Lssap
  29 from insights.parsers.saphostctrl import SAPHostCtrlInstances
  30 
  31 
  32 SAPInstances = namedtuple("SAPInstances",
  33         field_names=["name", "hostname", "sid", "type", "number", "version"])
  34 """namedtuple: Type for storing the SAP instance."""
  35 
  36 
  37 @combiner(hostname, optional=[SAPHostCtrlInstances, Lssap])
  38 class Sap(LegacyItemAccess):
  39     """
  40     Combiner for analyzing the SAP instances running on the system.
  41 
  42     Prefer SAPHostCtrlInstances to Lssap.
  43 
  44     Examples:
  45         >>> type(saps)
  46         <class 'insights.combiners.sap.Sap'>
  47         >>> saps['D16'].number
  48         '16'
  49         >>> saps.sid('HDB16')
  50         'HA2'
  51         >>> saps.hostname('HDB16')
  52         'lu0417'
  53         >>> 'D22' in saps.local_instances
  54         False
  55         >>> saps.is_hana
  56         True
  57         >>> saps.is_netweaver
  58         True
  59         >>> saps.is_ascs
  60         False
  61 
  62     Attributes:
  63         all_instances (list): List all the SAP instances listed by the command.
  64         local_instances (list): List SAP instances which are running on the system.
  65     """
  66 
  67     def __init__(self, hostname, insts, lssap):
  68         hn = hostname.hostname
  69         self.data = {}
  70         self.local_instances = []
  71         self.all_instances = []
  72         self._types = set()
  73         if insts:
  74             for inst in insts.data:
  75                 k = inst['InstanceName']
  76                 self.all_instances.append(k)
  77                 if hn == inst['Hostname']:
  78                     self.local_instances.append(k)
  79                     self._types.add(inst['InstanceType'])
  80                 self.data[k] = SAPInstances(k,
  81                                             inst['Hostname'],
  82                                             inst['SID'],
  83                                             inst['InstanceType'],
  84                                             inst['SystemNumber'],
  85                                             inst['SapVersionInfo'])
  86         elif lssap:
  87             for inst in lssap.data:
  88                 k = inst['Instance']
  89                 t = k.rstrip('1234567890')
  90                 self.all_instances.append(k)
  91                 if hn == inst['SAPLOCALHOST']:
  92                     self.local_instances.append(k)
  93                     self._types.add(t)
  94                 self.data[k] = SAPInstances(k,
  95                                             inst['SAPLOCALHOST'],
  96                                             inst['SID'],
  97                                             t,
  98                                             inst['Nr'],
  99                                             inst['Version'])
  100         else:
  101             raise SkipException('No SAP instance.')
  102 
  103     def version(self, instance):
  104         """str: Returns the version of the ``instance``."""
  105         return self.data[instance].version if instance in self.data else None
  106 
  107     def sid(self, instance):
  108         """str: Returns the sid of the ``instance``."""
  109         return self.data[instance].sid if instance in self.data else None
  110 
  111     def type(self, instance):
  112         """str: Returns the type code of the ``instance``."""
  113         return self.data[instance].type if instance in self.data else None
  114 
  115     def hostname(self, instance):
  116         """str: Returns the hostname of the ``instance``."""
  117         return self.data[instance].hostname if instance in self.data else None
  118 
  119     def number(self, instance):
  120         """str: Returns the systeme number of the ``instance``."""
  121         return self.data[instance].number if instance in self.data else None
  122 
  123     @property
  124     def is_netweaver(self):
  125         """bool: SAP Netweaver is running on the system."""
  126         return 'D' in self._types
  127 
  128     @property
  129     def is_hana(self):
  130         """bool: SAP Hana is running on the system."""
  131         return 'HDB' in self._types
  132 
  133     @property
  134     def is_ascs(self):
  135         """bool: SAP System Central Services is running on the system."""
  136         return 'ASCS' in self._types
  137
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/insights/combiners/sap.py b/insights/combiners/sap.py
  --- a/insights/combiners/sap.py
  +++ b/insights/combiners/sap.py
  @@ -52,6 +52,8 @@
           'lu0417'
           >>> 'D22' in saps.local_instances
           False
  +        >>> len(saps.business_instances)
  +        2
           >>> saps.is_hana
           True
           >>> saps.is_netweaver
  @@ -60,14 +62,19 @@
           False
   
       Attributes:
  -        all_instances (list): List all the SAP instances listed by the command.
  -        local_instances (list): List SAP instances which are running on the system.
  +        all_instances (list): List of all the SAP instances listed by the command.
  +        local_instances (list): List of SAP instances which are running on the system.
  +        function_instances (list): List of function SAP instances running on the system.
  +                                   E.g. Diagnostics Agents SMDA97/SMDA98
  +        business_instances (list): List of business SAP instances running on the system.
  +                                   E.g. HANA, NetWeaver, ASCS, or others
       """
  -
       def __init__(self, hostname, insts, lssap):
           hn = hostname.hostname
           self.data = {}
           self.local_instances = []
  +        self.business_instances = []
  +        self.function_instances = []
           self.all_instances = []
           self._types = set()
           if insts:
  @@ -100,6 +107,10 @@
           else:
               raise SkipException('No SAP instance.')
   
  +        FUNC_INSTS = ('SMDA')
  +        for i in self.local_instances:
  +            (self.function_instances if i.startswith(FUNC_INSTS) else self.business_instances).append(i)
  +
       def version(self, instance):
           """str: Returns the version of the ``instance``."""
           return self.data[instance].version if instance in self.data else None
  @@ -122,7 +133,7 @@
   
       @property
       def is_netweaver(self):
  -        """bool: SAP Netweaver is running on the system."""
  +        """bool: SAP NetWeaver is running on the system."""
           return 'D' in self._types
   
       @property
  
verification_info: {"golden_diff": "diff --git a/insights/combiners/sap.py b/insights/combiners/sap.py\n--- a/insights/combiners/sap.py\n+++ b/insights/combiners/sap.py\n@@ -52,6 +52,8 @@\n         'lu0417'\n         >>> 'D22' in saps.local_instances\n         False\n+        >>> len(saps.business_instances)\n+        2\n         >>> saps.is_hana\n         True\n         >>> saps.is_netweaver\n@@ -60,14 +62,19 @@\n         False\n \n     Attributes:\n-        all_instances (list): List all the SAP instances listed by the command.\n-        local_instances (list): List SAP instances which are running on the system.\n+        all_instances (list): List of all the SAP instances listed by the command.\n+        local_instances (list): List of SAP instances which are running on the system.\n+        function_instances (list): List of function SAP instances running on the system.\n+                                   E.g. Diagnostics Agents SMDA97/SMDA98\n+        business_instances (list): List of business SAP instances running on the system.\n+                                   E.g. HANA, NetWeaver, ASCS, or others\n     \"\"\"\n-\n     def __init__(self, hostname, insts, lssap):\n         hn = hostname.hostname\n         self.data = {}\n         self.local_instances = []\n+        self.business_instances = []\n+        self.function_instances = []\n         self.all_instances = []\n         self._types = set()\n         if insts:\n@@ -100,6 +107,10 @@\n         else:\n             raise SkipException('No SAP instance.')\n \n+        FUNC_INSTS = ('SMDA')\n+        for i in self.local_instances:\n+            (self.function_instances if i.startswith(FUNC_INSTS) else self.business_instances).append(i)\n+\n     def version(self, instance):\n         \"\"\"str: Returns the version of the ``instance``.\"\"\"\n         return self.data[instance].version if instance in self.data else None\n@@ -122,7 +133,7 @@\n \n     @property\n     def is_netweaver(self):\n-        \"\"\"bool: SAP Netweaver is running on the system.\"\"\"\n+        \"\"\"bool: SAP NetWeaver is running on the system.\"\"\"\n         return 'D' in self._types\n \n     @property\n", "issue": "SMDA* is not business SAP instances\n~~~\r\n# cat insights_commands/usr.sap.hostctrl.exe.saphostctrl_-function_GetCIMObject_-enuminstances_SAPInstance\r\n*********************************************************\r\n CreationClassName , String , SAPInstance\r\n SID , String , SMA\r\n SystemNumber , String , 98\r\n InstanceName , String , SMDA98\r\n Hostname , String , li-ld-1846\r\n FullQualifiedHostname , String , li-ld-1846.hag.hilti.com\r\n SapVersionInfo , String , 749, patch 200, changelist 1746260\r\n~~~\r\n\r\nFrom Rolf:\r\n> the reported instance SMDA98 is the Solution Manager agent, which the customer wants use to monitor that system [1]. With newer systems, that can alternatively also be the diagnostic agent (instance name DAA*98).\r\n* here is a typo, DAA should be SID name\n", "before_files": [{"content": "\"\"\"\nSap - Combiner\n==============\n\nThis combiner gets the running SAP instances on the system based on below\nlogic::\n\n    if (SAPLOCALHOST = 'hostname') && InstanceType = D## ) then\n        on this system runs SAP Netweaver Application Server version\n\n    if (SAPLOCALHOST = 'hostname') && InstanceType = ASCS## ) then\n        on this system runs SAP Netweaver Application Server Central Instance\n        version\n\n    if (SAPLOCALHOST = 'hostname') && InstanceType = HDB## ) then\n        on this system runs SAP HANA database version\n\nCheck settings according SAP Notes compiled here:\nhttps://wiki.scn.sap.com/wiki/x/rDK7Gg\n\n\"\"\"\n\nfrom collections import namedtuple\nfrom insights import LegacyItemAccess\nfrom insights.parsers import SkipException\nfrom insights.core.plugins import combiner\nfrom insights.combiners.hostname import hostname\nfrom insights.parsers.lssap import Lssap\nfrom insights.parsers.saphostctrl import SAPHostCtrlInstances\n\n\nSAPInstances = namedtuple(\"SAPInstances\",\n        field_names=[\"name\", \"hostname\", \"sid\", \"type\", \"number\", \"version\"])\n\"\"\"namedtuple: Type for storing the SAP instance.\"\"\"\n\n\n@combiner(hostname, optional=[SAPHostCtrlInstances, Lssap])\nclass Sap(LegacyItemAccess):\n    \"\"\"\n    Combiner for analyzing the SAP instances running on the system.\n\n    Prefer SAPHostCtrlInstances to Lssap.\n\n    Examples:\n        >>> type(saps)\n        <class 'insights.combiners.sap.Sap'>\n        >>> saps['D16'].number\n        '16'\n        >>> saps.sid('HDB16')\n        'HA2'\n        >>> saps.hostname('HDB16')\n        'lu0417'\n        >>> 'D22' in saps.local_instances\n        False\n        >>> saps.is_hana\n        True\n        >>> saps.is_netweaver\n        True\n        >>> saps.is_ascs\n        False\n\n    Attributes:\n        all_instances (list): List all the SAP instances listed by the command.\n        local_instances (list): List SAP instances which are running on the system.\n    \"\"\"\n\n    def __init__(self, hostname, insts, lssap):\n        hn = hostname.hostname\n        self.data = {}\n        self.local_instances = []\n        self.all_instances = []\n        self._types = set()\n        if insts:\n            for inst in insts.data:\n                k = inst['InstanceName']\n                self.all_instances.append(k)\n                if hn == inst['Hostname']:\n                    self.local_instances.append(k)\n                    self._types.add(inst['InstanceType'])\n                self.data[k] = SAPInstances(k,\n                                            inst['Hostname'],\n                                            inst['SID'],\n                                            inst['InstanceType'],\n                                            inst['SystemNumber'],\n                                            inst['SapVersionInfo'])\n        elif lssap:\n            for inst in lssap.data:\n                k = inst['Instance']\n                t = k.rstrip('1234567890')\n                self.all_instances.append(k)\n                if hn == inst['SAPLOCALHOST']:\n                    self.local_instances.append(k)\n                    self._types.add(t)\n                self.data[k] = SAPInstances(k,\n                                            inst['SAPLOCALHOST'],\n                                            inst['SID'],\n                                            t,\n                                            inst['Nr'],\n                                            inst['Version'])\n        else:\n            raise SkipException('No SAP instance.')\n\n    def version(self, instance):\n        \"\"\"str: Returns the version of the ``instance``.\"\"\"\n        return self.data[instance].version if instance in self.data else None\n\n    def sid(self, instance):\n        \"\"\"str: Returns the sid of the ``instance``.\"\"\"\n        return self.data[instance].sid if instance in self.data else None\n\n    def type(self, instance):\n        \"\"\"str: Returns the type code of the ``instance``.\"\"\"\n        return self.data[instance].type if instance in self.data else None\n\n    def hostname(self, instance):\n        \"\"\"str: Returns the hostname of the ``instance``.\"\"\"\n        return self.data[instance].hostname if instance in self.data else None\n\n    def number(self, instance):\n        \"\"\"str: Returns the systeme number of the ``instance``.\"\"\"\n        return self.data[instance].number if instance in self.data else None\n\n    @property\n    def is_netweaver(self):\n        \"\"\"bool: SAP Netweaver is running on the system.\"\"\"\n        return 'D' in self._types\n\n    @property\n    def is_hana(self):\n        \"\"\"bool: SAP Hana is running on the system.\"\"\"\n        return 'HDB' in self._types\n\n    @property\n    def is_ascs(self):\n        \"\"\"bool: SAP System Central Services is running on the system.\"\"\"\n        return 'ASCS' in self._types\n", "path": "insights/combiners/sap.py"}], "after_files": [{"content": "\"\"\"\nSap - Combiner\n==============\n\nThis combiner gets the running SAP instances on the system based on below\nlogic::\n\n    if (SAPLOCALHOST = 'hostname') && InstanceType = D## ) then\n        on this system runs SAP Netweaver Application Server version\n\n    if (SAPLOCALHOST = 'hostname') && InstanceType = ASCS## ) then\n        on this system runs SAP Netweaver Application Server Central Instance\n        version\n\n    if (SAPLOCALHOST = 'hostname') && InstanceType = HDB## ) then\n        on this system runs SAP HANA database version\n\nCheck settings according SAP Notes compiled here:\nhttps://wiki.scn.sap.com/wiki/x/rDK7Gg\n\n\"\"\"\n\nfrom collections import namedtuple\nfrom insights import LegacyItemAccess\nfrom insights.parsers import SkipException\nfrom insights.core.plugins import combiner\nfrom insights.combiners.hostname import hostname\nfrom insights.parsers.lssap import Lssap\nfrom insights.parsers.saphostctrl import SAPHostCtrlInstances\n\n\nSAPInstances = namedtuple(\"SAPInstances\",\n        field_names=[\"name\", \"hostname\", \"sid\", \"type\", \"number\", \"version\"])\n\"\"\"namedtuple: Type for storing the SAP instance.\"\"\"\n\n\n@combiner(hostname, optional=[SAPHostCtrlInstances, Lssap])\nclass Sap(LegacyItemAccess):\n    \"\"\"\n    Combiner for analyzing the SAP instances running on the system.\n\n    Prefer SAPHostCtrlInstances to Lssap.\n\n    Examples:\n        >>> type(saps)\n        <class 'insights.combiners.sap.Sap'>\n        >>> saps['D16'].number\n        '16'\n        >>> saps.sid('HDB16')\n        'HA2'\n        >>> saps.hostname('HDB16')\n        'lu0417'\n        >>> 'D22' in saps.local_instances\n        False\n        >>> len(saps.business_instances)\n        2\n        >>> saps.is_hana\n        True\n        >>> saps.is_netweaver\n        True\n        >>> saps.is_ascs\n        False\n\n    Attributes:\n        all_instances (list): List of all the SAP instances listed by the command.\n        local_instances (list): List of SAP instances which are running on the system.\n        function_instances (list): List of function SAP instances running on the system.\n                                   E.g. Diagnostics Agents SMDA97/SMDA98\n        business_instances (list): List of business SAP instances running on the system.\n                                   E.g. HANA, NetWeaver, ASCS, or others\n    \"\"\"\n    def __init__(self, hostname, insts, lssap):\n        hn = hostname.hostname\n        self.data = {}\n        self.local_instances = []\n        self.business_instances = []\n        self.function_instances = []\n        self.all_instances = []\n        self._types = set()\n        if insts:\n            for inst in insts.data:\n                k = inst['InstanceName']\n                self.all_instances.append(k)\n                if hn == inst['Hostname']:\n                    self.local_instances.append(k)\n                    self._types.add(inst['InstanceType'])\n                self.data[k] = SAPInstances(k,\n                                            inst['Hostname'],\n                                            inst['SID'],\n                                            inst['InstanceType'],\n                                            inst['SystemNumber'],\n                                            inst['SapVersionInfo'])\n        elif lssap:\n            for inst in lssap.data:\n                k = inst['Instance']\n                t = k.rstrip('1234567890')\n                self.all_instances.append(k)\n                if hn == inst['SAPLOCALHOST']:\n                    self.local_instances.append(k)\n                    self._types.add(t)\n                self.data[k] = SAPInstances(k,\n                                            inst['SAPLOCALHOST'],\n                                            inst['SID'],\n                                            t,\n                                            inst['Nr'],\n                                            inst['Version'])\n        else:\n            raise SkipException('No SAP instance.')\n\n        FUNC_INSTS = ('SMDA')\n        for i in self.local_instances:\n            (self.function_instances if i.startswith(FUNC_INSTS) else self.business_instances).append(i)\n\n    def version(self, instance):\n        \"\"\"str: Returns the version of the ``instance``.\"\"\"\n        return self.data[instance].version if instance in self.data else None\n\n    def sid(self, instance):\n        \"\"\"str: Returns the sid of the ``instance``.\"\"\"\n        return self.data[instance].sid if instance in self.data else None\n\n    def type(self, instance):\n        \"\"\"str: Returns the type code of the ``instance``.\"\"\"\n        return self.data[instance].type if instance in self.data else None\n\n    def hostname(self, instance):\n        \"\"\"str: Returns the hostname of the ``instance``.\"\"\"\n        return self.data[instance].hostname if instance in self.data else None\n\n    def number(self, instance):\n        \"\"\"str: Returns the systeme number of the ``instance``.\"\"\"\n        return self.data[instance].number if instance in self.data else None\n\n    @property\n    def is_netweaver(self):\n        \"\"\"bool: SAP NetWeaver is running on the system.\"\"\"\n        return 'D' in self._types\n\n    @property\n    def is_hana(self):\n        \"\"\"bool: SAP Hana is running on the system.\"\"\"\n        return 'HDB' in self._types\n\n    @property\n    def is_ascs(self):\n        \"\"\"bool: SAP System Central Services is running on the system.\"\"\"\n        return 'ASCS' in self._types\n", "path": "insights/combiners/sap.py"}]}