Closed awfki closed 7 years ago
@awfki This should work in the YAML file (I just tested it).
password: 'pass\word'
In your comment above, you are probably misinterpreting Python's internal storage of it (i.e. internally Python will store this as 'pass\word' as it has to backslash escape the backslash. To verify it properly do a
print password
and look at it on the screen.
>>> a = r'pass\word'
>>> print a
pass\word
>>> a
'pass\\word'
In the YAML file there doesn't appear to be a way to include a password with a backslash ().
My current password is not "pass\word" but that's close enough for testing. I tried various combinations of quotes and \ in YAML file and none of them work properly.
Using
password: pass\word
(no quotes, one slash) results in the password being "pass\word" with two backslashes in it.Using
password: "pass\word"
(double quotes, one slash) results in an error with a lot of output ending with:Using
password: "pass\\word"
(double quotes, two slashes) results in the password being "pass\word" with two backslashes in it.Using
password: 'pass\word'
(single quotes, one slash) results in the password being "pass\word" with two backslashes in it.Using
password: 'pass\\word'
(single quotes, two slashes) results in the password being "pass\\word" with four backslashes in it.Additionally it doesn't fail cleanly, that is, there's no error message or timeout. The SSH fails (%%%failed%%% in the tmp file) with no error message and the call to
proc.communicate()
(line 48 of netmiko-grep) never returns. When I hit control-c it gives this message:If I insert
return 0
at line 48 (in netmiko-grep) right beforeproc.communicate()
then the script finishes with this output: