I have a python application that sends a wide variety of unix commands using pxssh to a remote server using the versions below.
Version info: Python - 3.6.5 pexpect - 4.2.1
On one particular server one of our commands failed to execute because the command was truncated by (we think) pxssh.
We are not able to reproduce the issue in our dev/test envs, and cannot test in a PROD system for obvious reasons. This is also the first time this has happened on any of our systems. A similar command (the same in all but 1 character - different date), successfully executed immediately before this command failed.
In the log snippet below you can see the path of the scp target is truncated by 1 character. Any ideas on what to look at for why this occurred?
Code snippet showing creation and use of pxssh object:
self.connection = pxssh.pxssh(encoding='utf-8', echo=True,
timeout=None,
options={"StrictHostKeyChecking": "no"})
...
self.logger.info(self.log_header + 'The command is: ' + command)
self.connection.sendline(command)
self.connection.prompt()
log = self.connection.before
...
self.logger.info(self.log_header + log)
self.logger.info(self.log_header + 'Executed command: ' + command)
Here is the sanitized log output showing the error:
[INFO] The command is: scp -p *20190717* <server>:/path/to/target/location/
[INFO] Command output: [YOU HAVE NEW MAIL]
/path/to/target/locatio: No such file or directory
As you can see above, the n/
was truncated from /path/to/target/location/
Here is what success looks like (again sanitized):
[INFO] The command is: scp -p *20190718* <server>:/path/to/target/location/
[INFO] Command output: [YOU HAVE NEW MAIL]
File1 100% 53MB 16.0MB/s 00:03
File2 100% 20MB 16.2MB/s 00:01
[INFO] Executed command: scp -p *20190718* <server>:/path/to/target/location/