consolidator
/
copyToRepo.py
26 строк · 908.0 Байт
1import os2import paramiko3import getpass4
5repoHost="vsys01775"6repoUser="blokhin_sn"7
8if __name__=="__main__":9try:10print("copy distributive to repo")11ssh = paramiko.SSHClient()12ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))13passw = getpass.getpass(f"Пароль {repoUser}@{repoHost}:")14ssh.connect(repoHost,username=repoUser,password=passw)15print(f"{repoHost} connected")16sftp = ssh.open_sftp()17localpath="D:\\work\\Укрупнение\\current\\pyExcelCons3\\dist\\Consolidation-v.1.2.0.3.zip"18remotepath="/home/blokhin_sn/repo/Consolidation-v.1.2.0.3.zip"19print("sftp opened")20sftp.put(localpath,remotepath)21print("file puted")22sftp.close()23ssh.close()24print("connection closed")25except Exception as exp:26print(f"repo error: {exp}")