Fixes eos sending 'None' to device (#33015)

* Fix network_cli sometimes sending 'None' to device

* Also fix `--become-method=enable`
This commit is contained in:
Nathaniel Case 2017-11-17 11:33:54 -05:00 committed by GitHub
parent 5747bf34d1
commit 71a6dcdf3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -116,7 +116,7 @@ class Connection(ConnectionBase):
cmd = json.loads(to_text(cmd, errors='surrogate_or_strict'))
kwargs = {'command': to_bytes(cmd['command'], errors='surrogate_or_strict')}
for key in ('prompt', 'answer', 'send_only'):
if key in cmd:
if cmd.get(key) is not None:
kwargs[key] = to_bytes(cmd[key], errors='surrogate_or_strict')
return self.send(**kwargs)
except ValueError: