Fix stray string in network_cli (#51142)

* Replace loose string that should be a byte string

* Replace byte string literals with string literals

* These, on the other hand, need to be byte strings
This commit is contained in:
Nathaniel Case 2019-01-22 09:07:04 -05:00 committed by GitHub
commit 8d4f7f5b56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 61 additions and 61 deletions

View file

@ -32,9 +32,9 @@ class Cliconf(CliconfBase):
device_info = {}
device_info['network_os'] = 'cnos'
reply = self.get(b'show sys-info')
reply = self.get('show sys-info')
data = to_text(reply, errors='surrogate_or_strict').strip()
host = self.get(b'show hostname')
host = self.get('show hostname')
hostname = to_text(host, errors='surrogate_or_strict').strip()
if data:
device_info['network_os_version'] = self.parse_version(data)
@ -70,14 +70,14 @@ class Cliconf(CliconfBase):
msg = "fetching configuration from %s is not supported"
return self.invalid_params(msg % source)
if source == 'running':
cmd = b'show running-config'
cmd = 'show running-config'
else:
cmd = b'show startup-config'
cmd = 'show startup-config'
return self.send_command(cmd)
@enable_mode
def edit_config(self, command):
for cmd in chain([b'configure terminal'], to_list(command), [b'end']):
for cmd in chain(['configure terminal'], to_list(command), ['end']):
self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False, check_all=False):