prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Huawei vrpv8 commit func issue
  After commiting changes on huawei vrpv8, cli on devices look like this: 
  ```
  [~HUAWEI]dot1x enable
  [*HUAWEI]snmp-agent sys-info version all
  Warning: SNMPv1/SNMPv2c is not secure, and SNMPv3 in either authentication or privacy mode is recommended.
  [*HUAWEI]commit
  [~HUAWEI]
  ```
  
  
  with following code: 
  
  ```
  from netmiko import Netmiko
  
  device = {
      "host": "10.0.0.3",
      "username": "yyy",
      "password": "xxx",
      "device_type": "huawei_vrpv8",
      "session_log": "log_file2.txt"
  }
  config_commands = ['dot1x enable','snmp-agent sys-info version all']
  net_connect = Netmiko(**device)
  
  output = net_connect.send_config_set(config_commands,exit_config_mode=False)
  output += net_connect.commit()
  print(output)
  ```
  
  i got this error: 
  
  ```
  Traceback (most recent call last):
    File "/home/kafooo/PycharmProjects/nornir_scripts/venv/huawei_netmiko_test.py", line 18, in <module>
      output2 = net_connect.commit()
    File "/home/kafooo/PycharmProjects/nornir_scripts/venv/lib/python3.6/site-packages/netmiko/huawei/huawei_ssh.py", line 114, in commit
      strip_command=False, delay_factor=delay_factor)
    File "/home/kafooo/PycharmProjects/nornir_scripts/venv/lib/python3.6/site-packages/netmiko/base_connection.py", line 1206, in send_command_expect
      return self.send_command(*args, **kwargs)
    File "/home/kafooo/PycharmProjects/nornir_scripts/venv/lib/python3.6/site-packages/netmiko/base_connection.py", line 1188, in send_command
      search_pattern))
  OSError: Search pattern never detected in send_command_expect: \[\*HUAWEI\]
  ```
  
  
  looks like netmiko is expecting [*hostname] after commit, but in reality there is [~hostname] after commit
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `netmiko/huawei/huawei_ssh.py`
  Content:
  ```
  1 from __future__ import print_function
  2 from __future__ import unicode_literals
  3 import time
  4 import re
  5 from netmiko.cisco_base_connection import CiscoSSHConnection
  6 from netmiko import log
  7 
  8 
  9 class HuaweiSSH(CiscoSSHConnection):
  10     def session_preparation(self):
  11         """Prepare the session after the connection has been established."""
  12         self._test_channel_read()
  13         self.set_base_prompt()
  14         self.disable_paging(command="screen-length 0 temporary")
  15         # Clear the read buffer
  16         time.sleep(0.3 * self.global_delay_factor)
  17         self.clear_buffer()
  18 
  19     def config_mode(self, config_command="system-view"):
  20         """Enter configuration mode."""
  21         return super(HuaweiSSH, self).config_mode(config_command=config_command)
  22 
  23     def exit_config_mode(self, exit_config="return", pattern=r">"):
  24         """Exit configuration mode."""
  25         return super(HuaweiSSH, self).exit_config_mode(
  26             exit_config=exit_config, pattern=pattern
  27         )
  28 
  29     def check_config_mode(self, check_string="]"):
  30         """Checks whether in configuration mode. Returns a boolean."""
  31         return super(HuaweiSSH, self).check_config_mode(check_string=check_string)
  32 
  33     def check_enable_mode(self, *args, **kwargs):
  34         """Huawei has no enable mode."""
  35         pass
  36 
  37     def enable(self, *args, **kwargs):
  38         """Huawei has no enable mode."""
  39         return ""
  40 
  41     def exit_enable_mode(self, *args, **kwargs):
  42         """Huawei has no enable mode."""
  43         return ""
  44 
  45     def set_base_prompt(
  46         self, pri_prompt_terminator=">", alt_prompt_terminator="]", delay_factor=1
  47     ):
  48         """
  49         Sets self.base_prompt
  50 
  51         Used as delimiter for stripping of trailing prompt in output.
  52 
  53         Should be set to something that is general and applies in multiple contexts. For Comware
  54         this will be the router prompt with < > or [ ] stripped off.
  55 
  56         This will be set on logging in, but not when entering system-view
  57         """
  58         log.debug("In set_base_prompt")
  59         delay_factor = self.select_delay_factor(delay_factor)
  60         self.clear_buffer()
  61         self.write_channel(self.RETURN)
  62         time.sleep(0.5 * delay_factor)
  63 
  64         prompt = self.read_channel()
  65         prompt = self.normalize_linefeeds(prompt)
  66 
  67         # If multiple lines in the output take the last line
  68         prompt = prompt.split(self.RESPONSE_RETURN)[-1]
  69         prompt = prompt.strip()
  70 
  71         # Check that ends with a valid terminator character
  72         if not prompt[-1] in (pri_prompt_terminator, alt_prompt_terminator):
  73             raise ValueError("Router prompt not found: {0}".format(prompt))
  74 
  75         # Strip off any leading HRP_. characters for USGv5 HA
  76         prompt = re.sub(r"^HRP_.", "", prompt, flags=re.M)
  77 
  78         # Strip off leading and trailing terminator
  79         prompt = prompt[1:-1]
  80         prompt = prompt.strip()
  81         self.base_prompt = prompt
  82         log.debug("prompt: {0}".format(self.base_prompt))
  83 
  84         return self.base_prompt
  85 
  86     def save_config(self, cmd="save", confirm=False, confirm_response=""):
  87         """ Save Config for HuaweiSSH"""
  88         return super(HuaweiSSH, self).save_config(cmd=cmd, confirm=confirm)
  89 
  90 
  91 class HuaweiVrpv8SSH(HuaweiSSH):
  92     def commit(self, comment="", delay_factor=1):
  93         """
  94         Commit the candidate configuration.
  95 
  96         Commit the entered configuration. Raise an error and return the failure
  97         if the commit fails.
  98 
  99         default:
  100            command_string = commit
  101         comment:
  102            command_string = commit comment <comment>
  103 
  104         """
  105         delay_factor = self.select_delay_factor(delay_factor)
  106         error_marker = "Failed to generate committed config"
  107         command_string = "commit"
  108 
  109         if comment:
  110             command_string += ' comment "{}"'.format(comment)
  111 
  112         output = self.config_mode()
  113         output += self.send_command_expect(
  114             command_string,
  115             strip_prompt=False,
  116             strip_command=False,
  117             delay_factor=delay_factor,
  118         )
  119         output += self.exit_config_mode()
  120 
  121         if error_marker in output:
  122             raise ValueError(
  123                 "Commit failed with following errors:\n\n{}".format(output)
  124             )
  125         return output
  126 
  127     def save_config(self, cmd="", confirm=True, confirm_response=""):
  128         """Not Implemented"""
  129         raise NotImplementedError
  130
  ```
  --- 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/netmiko/huawei/huawei_ssh.py b/netmiko/huawei/huawei_ssh.py
  --- a/netmiko/huawei/huawei_ssh.py
  +++ b/netmiko/huawei/huawei_ssh.py
  @@ -115,6 +115,7 @@
               strip_prompt=False,
               strip_command=False,
               delay_factor=delay_factor,
  +            expect_string=r"]",
           )
           output += self.exit_config_mode()
  
verification_info: {"golden_diff": "diff --git a/netmiko/huawei/huawei_ssh.py b/netmiko/huawei/huawei_ssh.py\n--- a/netmiko/huawei/huawei_ssh.py\n+++ b/netmiko/huawei/huawei_ssh.py\n@@ -115,6 +115,7 @@\n             strip_prompt=False,\n             strip_command=False,\n             delay_factor=delay_factor,\n+            expect_string=r\"]\",\n         )\n         output += self.exit_config_mode()\n", "issue": "Huawei vrpv8 commit func issue\nAfter commiting changes on huawei vrpv8, cli on devices look like this: \r\n```\r\n[~HUAWEI]dot1x enable\r\n[*HUAWEI]snmp-agent sys-info version all\r\nWarning: SNMPv1/SNMPv2c is not secure, and SNMPv3 in either authentication or privacy mode is recommended.\r\n[*HUAWEI]commit\r\n[~HUAWEI]\r\n```\r\n\r\n\r\nwith following code: \r\n\r\n```\r\nfrom netmiko import Netmiko\r\n\r\ndevice = {\r\n    \"host\": \"10.0.0.3\",\r\n    \"username\": \"yyy\",\r\n    \"password\": \"xxx\",\r\n    \"device_type\": \"huawei_vrpv8\",\r\n    \"session_log\": \"log_file2.txt\"\r\n}\r\nconfig_commands = ['dot1x enable','snmp-agent sys-info version all']\r\nnet_connect = Netmiko(**device)\r\n\r\noutput = net_connect.send_config_set(config_commands,exit_config_mode=False)\r\noutput += net_connect.commit()\r\nprint(output)\r\n```\r\n\r\ni got this error: \r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/kafooo/PycharmProjects/nornir_scripts/venv/huawei_netmiko_test.py\", line 18, in <module>\r\n    output2 = net_connect.commit()\r\n  File \"/home/kafooo/PycharmProjects/nornir_scripts/venv/lib/python3.6/site-packages/netmiko/huawei/huawei_ssh.py\", line 114, in commit\r\n    strip_command=False, delay_factor=delay_factor)\r\n  File \"/home/kafooo/PycharmProjects/nornir_scripts/venv/lib/python3.6/site-packages/netmiko/base_connection.py\", line 1206, in send_command_expect\r\n    return self.send_command(*args, **kwargs)\r\n  File \"/home/kafooo/PycharmProjects/nornir_scripts/venv/lib/python3.6/site-packages/netmiko/base_connection.py\", line 1188, in send_command\r\n    search_pattern))\r\nOSError: Search pattern never detected in send_command_expect: \\[\\*HUAWEI\\]\r\n```\r\n\r\n\r\nlooks like netmiko is expecting [*hostname] after commit, but in reality there is [~hostname] after commit\n", "before_files": [{"content": "from __future__ import print_function\nfrom __future__ import unicode_literals\nimport time\nimport re\nfrom netmiko.cisco_base_connection import CiscoSSHConnection\nfrom netmiko import log\n\n\nclass HuaweiSSH(CiscoSSHConnection):\n    def session_preparation(self):\n        \"\"\"Prepare the session after the connection has been established.\"\"\"\n        self._test_channel_read()\n        self.set_base_prompt()\n        self.disable_paging(command=\"screen-length 0 temporary\")\n        # Clear the read buffer\n        time.sleep(0.3 * self.global_delay_factor)\n        self.clear_buffer()\n\n    def config_mode(self, config_command=\"system-view\"):\n        \"\"\"Enter configuration mode.\"\"\"\n        return super(HuaweiSSH, self).config_mode(config_command=config_command)\n\n    def exit_config_mode(self, exit_config=\"return\", pattern=r\">\"):\n        \"\"\"Exit configuration mode.\"\"\"\n        return super(HuaweiSSH, self).exit_config_mode(\n            exit_config=exit_config, pattern=pattern\n        )\n\n    def check_config_mode(self, check_string=\"]\"):\n        \"\"\"Checks whether in configuration mode. Returns a boolean.\"\"\"\n        return super(HuaweiSSH, self).check_config_mode(check_string=check_string)\n\n    def check_enable_mode(self, *args, **kwargs):\n        \"\"\"Huawei has no enable mode.\"\"\"\n        pass\n\n    def enable(self, *args, **kwargs):\n        \"\"\"Huawei has no enable mode.\"\"\"\n        return \"\"\n\n    def exit_enable_mode(self, *args, **kwargs):\n        \"\"\"Huawei has no enable mode.\"\"\"\n        return \"\"\n\n    def set_base_prompt(\n        self, pri_prompt_terminator=\">\", alt_prompt_terminator=\"]\", delay_factor=1\n    ):\n        \"\"\"\n        Sets self.base_prompt\n\n        Used as delimiter for stripping of trailing prompt in output.\n\n        Should be set to something that is general and applies in multiple contexts. For Comware\n        this will be the router prompt with < > or [ ] stripped off.\n\n        This will be set on logging in, but not when entering system-view\n        \"\"\"\n        log.debug(\"In set_base_prompt\")\n        delay_factor = self.select_delay_factor(delay_factor)\n        self.clear_buffer()\n        self.write_channel(self.RETURN)\n        time.sleep(0.5 * delay_factor)\n\n        prompt = self.read_channel()\n        prompt = self.normalize_linefeeds(prompt)\n\n        # If multiple lines in the output take the last line\n        prompt = prompt.split(self.RESPONSE_RETURN)[-1]\n        prompt = prompt.strip()\n\n        # Check that ends with a valid terminator character\n        if not prompt[-1] in (pri_prompt_terminator, alt_prompt_terminator):\n            raise ValueError(\"Router prompt not found: {0}\".format(prompt))\n\n        # Strip off any leading HRP_. characters for USGv5 HA\n        prompt = re.sub(r\"^HRP_.\", \"\", prompt, flags=re.M)\n\n        # Strip off leading and trailing terminator\n        prompt = prompt[1:-1]\n        prompt = prompt.strip()\n        self.base_prompt = prompt\n        log.debug(\"prompt: {0}\".format(self.base_prompt))\n\n        return self.base_prompt\n\n    def save_config(self, cmd=\"save\", confirm=False, confirm_response=\"\"):\n        \"\"\" Save Config for HuaweiSSH\"\"\"\n        return super(HuaweiSSH, self).save_config(cmd=cmd, confirm=confirm)\n\n\nclass HuaweiVrpv8SSH(HuaweiSSH):\n    def commit(self, comment=\"\", delay_factor=1):\n        \"\"\"\n        Commit the candidate configuration.\n\n        Commit the entered configuration. Raise an error and return the failure\n        if the commit fails.\n\n        default:\n           command_string = commit\n        comment:\n           command_string = commit comment <comment>\n\n        \"\"\"\n        delay_factor = self.select_delay_factor(delay_factor)\n        error_marker = \"Failed to generate committed config\"\n        command_string = \"commit\"\n\n        if comment:\n            command_string += ' comment \"{}\"'.format(comment)\n\n        output = self.config_mode()\n        output += self.send_command_expect(\n            command_string,\n            strip_prompt=False,\n            strip_command=False,\n            delay_factor=delay_factor,\n        )\n        output += self.exit_config_mode()\n\n        if error_marker in output:\n            raise ValueError(\n                \"Commit failed with following errors:\\n\\n{}\".format(output)\n            )\n        return output\n\n    def save_config(self, cmd=\"\", confirm=True, confirm_response=\"\"):\n        \"\"\"Not Implemented\"\"\"\n        raise NotImplementedError\n", "path": "netmiko/huawei/huawei_ssh.py"}], "after_files": [{"content": "from __future__ import print_function\nfrom __future__ import unicode_literals\nimport time\nimport re\nfrom netmiko.cisco_base_connection import CiscoSSHConnection\nfrom netmiko import log\n\n\nclass HuaweiSSH(CiscoSSHConnection):\n    def session_preparation(self):\n        \"\"\"Prepare the session after the connection has been established.\"\"\"\n        self._test_channel_read()\n        self.set_base_prompt()\n        self.disable_paging(command=\"screen-length 0 temporary\")\n        # Clear the read buffer\n        time.sleep(0.3 * self.global_delay_factor)\n        self.clear_buffer()\n\n    def config_mode(self, config_command=\"system-view\"):\n        \"\"\"Enter configuration mode.\"\"\"\n        return super(HuaweiSSH, self).config_mode(config_command=config_command)\n\n    def exit_config_mode(self, exit_config=\"return\", pattern=r\">\"):\n        \"\"\"Exit configuration mode.\"\"\"\n        return super(HuaweiSSH, self).exit_config_mode(\n            exit_config=exit_config, pattern=pattern\n        )\n\n    def check_config_mode(self, check_string=\"]\"):\n        \"\"\"Checks whether in configuration mode. Returns a boolean.\"\"\"\n        return super(HuaweiSSH, self).check_config_mode(check_string=check_string)\n\n    def check_enable_mode(self, *args, **kwargs):\n        \"\"\"Huawei has no enable mode.\"\"\"\n        pass\n\n    def enable(self, *args, **kwargs):\n        \"\"\"Huawei has no enable mode.\"\"\"\n        return \"\"\n\n    def exit_enable_mode(self, *args, **kwargs):\n        \"\"\"Huawei has no enable mode.\"\"\"\n        return \"\"\n\n    def set_base_prompt(\n        self, pri_prompt_terminator=\">\", alt_prompt_terminator=\"]\", delay_factor=1\n    ):\n        \"\"\"\n        Sets self.base_prompt\n\n        Used as delimiter for stripping of trailing prompt in output.\n\n        Should be set to something that is general and applies in multiple contexts. For Comware\n        this will be the router prompt with < > or [ ] stripped off.\n\n        This will be set on logging in, but not when entering system-view\n        \"\"\"\n        log.debug(\"In set_base_prompt\")\n        delay_factor = self.select_delay_factor(delay_factor)\n        self.clear_buffer()\n        self.write_channel(self.RETURN)\n        time.sleep(0.5 * delay_factor)\n\n        prompt = self.read_channel()\n        prompt = self.normalize_linefeeds(prompt)\n\n        # If multiple lines in the output take the last line\n        prompt = prompt.split(self.RESPONSE_RETURN)[-1]\n        prompt = prompt.strip()\n\n        # Check that ends with a valid terminator character\n        if not prompt[-1] in (pri_prompt_terminator, alt_prompt_terminator):\n            raise ValueError(\"Router prompt not found: {0}\".format(prompt))\n\n        # Strip off any leading HRP_. characters for USGv5 HA\n        prompt = re.sub(r\"^HRP_.\", \"\", prompt, flags=re.M)\n\n        # Strip off leading and trailing terminator\n        prompt = prompt[1:-1]\n        prompt = prompt.strip()\n        self.base_prompt = prompt\n        log.debug(\"prompt: {0}\".format(self.base_prompt))\n\n        return self.base_prompt\n\n    def save_config(self, cmd=\"save\", confirm=False, confirm_response=\"\"):\n        \"\"\" Save Config for HuaweiSSH\"\"\"\n        return super(HuaweiSSH, self).save_config(cmd=cmd, confirm=confirm)\n\n\nclass HuaweiVrpv8SSH(HuaweiSSH):\n    def commit(self, comment=\"\", delay_factor=1):\n        \"\"\"\n        Commit the candidate configuration.\n\n        Commit the entered configuration. Raise an error and return the failure\n        if the commit fails.\n\n        default:\n           command_string = commit\n        comment:\n           command_string = commit comment <comment>\n\n        \"\"\"\n        delay_factor = self.select_delay_factor(delay_factor)\n        error_marker = \"Failed to generate committed config\"\n        command_string = \"commit\"\n\n        if comment:\n            command_string += ' comment \"{}\"'.format(comment)\n\n        output = self.config_mode()\n        output += self.send_command_expect(\n            command_string,\n            strip_prompt=False,\n            strip_command=False,\n            delay_factor=delay_factor,\n            expect_string=r\"]\",\n        )\n        output += self.exit_config_mode()\n\n        if error_marker in output:\n            raise ValueError(\n                \"Commit failed with following errors:\\n\\n{}\".format(output)\n            )\n        return output\n\n    def save_config(self, cmd=\"\", confirm=True, confirm_response=\"\"):\n        \"\"\"Not Implemented\"\"\"\n        raise NotImplementedError\n", "path": "netmiko/huawei/huawei_ssh.py"}]}