{"action":"closed","issue":{"url":"https://api.github.com/repos/ktbyers/netmiko/issues/216","repository_url":"https://api.github.com/repos/ktbyers/netmiko","labels_url":"https://api.github.com/repos/ktbyers/netmiko/issues/216/labels{/name}","comments_url":"https://api.github.com/repos/ktbyers/netmiko/issues/216/comments","events_url":"https://api.github.com/repos/ktbyers/netmiko/issues/216/events","html_url":"https://github.com/ktbyers/netmiko/issues/216","id":156501693,"number":216,"title":"Entering config mode with long hostname fails.","user":{"login":"baileytj3","id":2779824,"avatar_url":"https://avatars.githubusercontent.com/u/2779824?v=3","gravatar_id":"","url":"https://api.github.com/users/baileytj3","html_url":"https://github.com/baileytj3","followers_url":"https://api.github.com/users/baileytj3/followers","following_url":"https://api.github.com/users/baileytj3/following{/other_user}","gists_url":"https://api.github.com/users/baileytj3/gists{/gist_id}","starred_url":"https://api.github.com/users/baileytj3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baileytj3/subscriptions","organizations_url":"https://api.github.com/users/baileytj3/orgs","repos_url":"https://api.github.com/users/baileytj3/repos","events_url":"https://api.github.com/users/baileytj3/events{/privacy}","received_events_url":"https://api.github.com/users/baileytj3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-24T13:03:34Z","updated_at":"2016-05-24T15:49:47Z","closed_at":"2016-05-24T15:49:47Z","body":"I was unsure whether this was related to #212. When entering config mode with an exceptionally long hostname on a Cisco switch, the switch truncates the prompt and appends the '(config)' text. This causes the following stack trace when config_mode() is called.\r\n```\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/lib/python2.6/site-packages/netmiko/ssh_connection.py\", line 27, in config_mode\r\n    return super(SSHConnection, self).config_mode(config_command=config_command)\r\n  File \"/usr/lib/python2.6/site-packages/netmiko/base_connection.py\", line 541, in config_mode\r\n    if not self.check_config_mode():\r\n  File \"/usr/lib/python2.6/site-packages/netmiko/ssh_connection.py\", line 23, in check_config_mode\r\n    return super(SSHConnection, self).check_config_mode(check_string=check_string)\r\n  File \"/usr/lib/python2.6/site-packages/netmiko/base_connection.py\", line 535, in check_config_mode\r\n    output = self.read_until_prompt()\r\n  File \"/usr/lib/python2.6/site-packages/netmiko/base_connection.py\", line 354, in read_until_prompt\r\n    return self.read_until_pattern()\r\n  File \"/usr/lib/python2.6/site-packages/netmiko/base_connection.py\", line 368, in read_until_pattern\r\n    raise NetMikoTimeoutException(\"Timed-out reading channel, data not available.\")\r\nnetmiko.ssh_exception.NetMikoTimeoutException: Timed-out reading channel, data not available.\r\n```\r\nPrompt as seen from manual ssh session to the switch.\r\n```\r\n012345678901234567890123456789#config t\r\nEnter configuration commands, one per line.  End with CNTL/Z.\r\n01234567890123456789(config)#\r\n```\r\nThe prompt changes and the original prompt is never found. I would suspect that the calling self.set_base_prompt() after self.remote_conn.sendall() in the following method would correct this issue, but I have yet to test it.\r\n\r\n```\r\ndef config_mode(self, config_command=''):                                   \r\n    \"\"\"Enter into config_mode.\"\"\"                                           \r\n    output = ''                                                             \r\n    if not self.check_config_mode():                                        \r\n        self.remote_conn.sendall(self.normalize_cmd(config_command))        \r\n        output = self.read_until_prompt()                                   \r\n        if not self.check_config_mode():                                    \r\n            raise ValueError(\"Failed to enter configuration mode.\")         \r\n    return output\r\n```"}}
{"actor":{"display_login":"ktbyers"}}