Python + paramiko + shell script?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Good day!

I have following task — create SSH connection with the server to upload by SFTP files (particularly source) and run it in the build script.

Doing this in Python using paramiko. Everything is OK except the actual start of the script. Run it through exec_command see only the first couple of messages and then the script stops (which is Python, so exec_command worked). Tell me — how to wait the end of the script and display the entire message?

Here are clippings from the code:
paramiko.util.log_to_file('ssh_session.log') ssh = SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ssh.connect(ssh_conf.server_address, ssh_conf.server_port, ssh_conf.login, None, my_pkey, 60) except: print 'Error connect' sys.exit(1) _sftp = ssh.open_sftp() SyncFolders(_sftp, ssh_conf.source_folder, ssh_conf.dest_folder) print ssh.exec_command('chmod +x' + ssh_conf.dest_folder + '/')[1].read() # iOrange - performing build print ssh.exec_command('sh' + ssh_conf.dest_folder + '/')[1].read()
by | 13 views

1 Answer

0 like 0 dislike
Fabric not suitable?

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
5 answers
asked Mar 25, 2019 by Lisio
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
38,658 users