Example #1
0
    def get_logs(self, _hosts):
        hosts = set(_hosts)
        basename = os.path.splitext(util.LOG_FILE)[0]
        connection = None

        util.remove_localhost(hosts)

        for host in hosts:
            new_name = "{0}-{1}.log".format(basename, host)
            try:
                connection = self.connect(self.ssh_user, self.ssh_private_key,
                                          host)
                sftp = connection.open_sftp()
                sftp.get(util.HOST_LOG_FILE, new_name)
            except:
                LOG.warning("clearstack: cannot get log file from {0}".format(
                    host))
            finally:
                if connection:
                    connection.close()