import glob
import shutil
from optparse import OptionParser

from perfrunner.helpers.remote import RemoteHelper
from perfrunner.settings import ClusterSpec


def get_options():
    usage = '%prog -c cluster'

    parser = OptionParser(usage)

    parser.add_option('-c', dest='cluster_spec_fname',
                      help='path to the cluster specification file',
                      metavar='cluster.spec')

    options, args = parser.parse_args()
    if not options.cluster_spec_fname:
        parser.error('Please specify a cluster specification')

    return options, args


def main():
    options, args = get_options()

    cluster_spec = ClusterSpec()
    cluster_spec.parse(options.cluster_spec_fname, args)

    remote = RemoteHelper(cluster_spec, test_config=None, verbose=False)

    remote.collect_info()
    for hostname in cluster_spec.yield_hostnames():
        for fname in glob.glob('{}/*.zip'.format(hostname)):
            shutil.move(fname, '{}.zip'.format(hostname))


if __name__ == '__main__':
    main()

import glob
import os.path
import shutil
from optparse import OptionParser

from perfrunner.helpers.remote import RemoteHelper
from perfrunner.settings import ClusterSpec


def get_options():
    usage = '%prog -c cluster'

    parser = OptionParser(usage)

    parser.add_option('-c', dest='cluster_spec_fname',
                      help='path to the cluster specification file',
                      metavar='cluster.spec')

    options, args = parser.parse_args()
    if not options.cluster_spec_fname:
        parser.error('Please specify a cluster specification')

    return options, args


def main():
    options, args = get_options()

    cluster_spec = ClusterSpec()
    cluster_spec.parse(options.cluster_spec_fname, args)

    remote = RemoteHelper(cluster_spec, test_config=None, verbose=False)

    remote.collect_info()
    for hostname in cluster_spec.yield_hostnames():
        for fname in glob.glob('{}/*.zip'.format(hostname)):
            shutil.move(fname, '{}.zip'.format(hostname))

    if cluster_spec.backup is not None:
        logs = os.path.join(cluster_spec.backup, 'logs')
        if os.path.exists(logs):
            shutil.make_archive('tools', 'zip', logs)


if __name__ == '__main__':
    main()

Archive logs from the tools
Archive logs from the tools

Change-Id: I184473d20cc2763fbc97c993bfcab36b80d1c864
Reviewed-on: http://review.couchbase.org/76571
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail.com>
