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.80": #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()