Exemplo n.º 1
0
 def _copy_helper_cmd(self, ssh):
     with self._lock:
         sftp = ssh.open_sftp()
         local_path = os.path.join(utils.get_resources_dir(), 'write_data')
         try:
             # Check if the remote file already exists
             sftp.stat('write_data')
         except IOError as ex:
             if ex.errno != errno.ENOENT:
                 raise
             sftp.put(local_path, 'write_data')
         finally:
             sftp.close()
Exemplo n.º 2
0
 def _copy_replicator_cmd(self, ssh):
     local_path = os.path.join(
         utils.get_resources_dir(), 'replicator')
     self._copy_file(ssh, local_path, REPLICATOR_PATH)
     utils.exec_ssh_cmd(
         ssh, "sudo chmod +x %s" % REPLICATOR_PATH, get_pty=True)