At my current position I’m getting the opportunity to do a lot of testing with
selenium (which I’ll talk about later) and vagrant. One of the things that
I need to accomplish during testing is dynamically starting the development environment
in “TEST MODE” to perform functional testing against the webapp backend.
>>> client = ssh.Connection('localhost', username='vagrant', password='vagrant', port=2222)
The issue that I was having is changing directories. A simple
cd .. didn’t seem
to want to do the trick:
>>> client.execute('cd ..')
I started thinking it’s a permission issue or something, but, no, the
should be root, nothing seemed to make the simple command execution work, at least,
I can’t think of another way to change directory on a linux box. And to make things
more intersting, it didn’t seem to matter if I used PySFTP or the aforementioned
ssh.py, the result was the same.
>>> client.execute('cd ..; pwd')
Just needed to execute the commands together. Why? Your guess is as good as mine…