Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ssh_connect(ip,user,pwd):
- '''
- This function will make an ssh connection to the ip using the credentials passed and return the handler
- Args:
- ip: IP Address of the box into which ssh has to be done
- user: User name of the box to which ssh has to be done
- pass: password of the box to which ssh has to be done
- Returns:
- An ssh handler
- '''
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(ip, username=user, password=pwd)
- return ssh
- ssh_obj = ssh_connect(ip, username, password)
- folder = "/var/xyz/images/" + build_number
- command = "mkdir " + folder
- ssh_stdin, ssh_stdout, ssh_stderr = ssh_obj.exec_command(command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement