mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Fix use of bytes in cliconf plugins for Python 3 (#37715)
* Remove raw byte-strings from cliconf plugins of supported platforms + edgeos Remove uses of to_bytes, too * Update CliConfBase docstring to reflect current position on byte strings
This commit is contained in:
parent
be6628cd3d
commit
3b3c72f3e5
9 changed files with 41 additions and 48 deletions
|
@ -33,13 +33,13 @@ class Cliconf(CliconfBase):
|
|||
device_info = {}
|
||||
|
||||
device_info['network_os'] = 'eos'
|
||||
reply = self.get(b'show version | json')
|
||||
reply = self.get('show version | json')
|
||||
data = json.loads(reply)
|
||||
|
||||
device_info['network_os_version'] = data['version']
|
||||
device_info['network_os_model'] = data['modelName']
|
||||
|
||||
reply = self.get(b'show hostname | json')
|
||||
reply = self.get('show hostname | json')
|
||||
data = json.loads(reply)
|
||||
|
||||
device_info['network_os_hostname'] = data['hostname']
|
||||
|
@ -52,9 +52,9 @@ class Cliconf(CliconfBase):
|
|||
if source not in lookup:
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
|
||||
cmd = b'show %s ' % lookup[source]
|
||||
cmd = 'show %s ' % lookup[source]
|
||||
if format and format is not 'text':
|
||||
cmd += b'| %s ' % format
|
||||
cmd += '| %s ' % format
|
||||
|
||||
cmd += ' '.join(to_list(flags))
|
||||
cmd = cmd.strip()
|
||||
|
@ -62,7 +62,7 @@ class Cliconf(CliconfBase):
|
|||
|
||||
@enable_mode
|
||||
def edit_config(self, command):
|
||||
for cmd in chain([b'configure'], to_list(command), [b'end']):
|
||||
for cmd in chain(['configure'], to_list(command), ['end']):
|
||||
self.send_command(cmd)
|
||||
|
||||
def get(self, command, prompt=None, answer=None, sendonly=False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue