JustSendFiles.py 1.01 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
import GanetiCluster, paramiko, os


class JustSendFiles(object):
def __init__(self):
eucacluster = GanetiCluster.GanetiCluster('Coordinator.properties')
instances = eucacluster.describe_instances()
for instance in instances:
ssh = paramiko.SSHClient()
transport = paramiko.Transport((instance.ip_address, 22))
transport.connect(username = 'root', password = 'secretpw')
transport.open_channel("session", instance.ip_address, "localhost")
sftp = paramiko.SFTPClient.from_transport(transport)
if instance.ip_address == "192.168.1.74": #master
experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar_master") for name in files]
else: #worker
experiment_assets = [os.path.join(root, name) for root, dirs, files in os.walk("./templates/gstar") for name in files]
for expasset in experiment_assets:
sftp.put(expasset,expasset.replace("./templates","/root"))
sftp.close()


if __name__ == "__main__":
sendthem = JustSendFiles()