Ejemplo n.º 1
0
 def import_bin_files(self):
     bin_dir = os.path.join(self.get_cassandra_dir(), 'bin')
     for name in os.listdir(bin_dir):
         filename = os.path.join(bin_dir, name)
         if os.path.isfile(filename):
             shutil.copy(filename, self.get_bin_dir())
             common.add_exec_permission(bin_dir, name)
Ejemplo n.º 2
0
Archivo: node.py Proyecto: driftx/ccm
 def import_bin_files(self):
     bin_dir = os.path.join(self.get_cassandra_dir(), 'bin')
     for name in os.listdir(bin_dir):
         filename = os.path.join(bin_dir, name)
         if os.path.isfile(filename):
             shutil.copy(filename, self.get_bin_dir())
             common.add_exec_permission(bin_dir, name)
Ejemplo n.º 3
0
Archivo: common.py Proyecto: driftx/ccm
def get_stress_bin(cassandra_dir):
    candidates = [
        os.path.join(cassandra_dir, 'contrib', 'stress', 'bin', 'stress'),
        os.path.join(cassandra_dir, 'tools', 'stress', 'bin', 'stress'),
        os.path.join(cassandra_dir, 'tools', 'bin', 'stress'),
        os.path.join(cassandra_dir, 'tools', 'bin', 'cassandra-stress')
    ]
    candidates = [common.platform_binary(s) for s in candidates]

    for candidate in candidates:
        if os.path.exists(candidate):
            stress = candidate
            break
    else:
        raise Exception("Cannot find stress binary (maybe it isn't compiled)")

    # make sure it's executable -> win32 doesn't care
    if sys.platform == "cygwin":
        # Yes, we're unwinding the path join from above.
        path = parse_path(stress)
        short_bin = parse_bin(stress)
        add_exec_permission(path, short_bin)
    elif not os.access(stress, os.X_OK):
        try:
            # try to add user execute permissions
            # os.chmod doesn't work on Windows and isn't necessary unless in cygwin...
            if sys.platform == "cygwin":
                common.add_exec_permission(path, stress)
            else:
                os.chmod(stress, os.stat(stress).st_mode | stat.S_IXUSR)
        except:
            raise Exception("stress binary is not executable: %s" % (stress,))

    return stress
Ejemplo n.º 4
0
Archivo: common.py Proyecto: Jsalim/ccm
def get_stress_bin(cassandra_dir):
    candidates = [
        os.path.join(cassandra_dir, 'contrib', 'stress', 'bin', 'stress'),
        os.path.join(cassandra_dir, 'tools', 'stress', 'bin', 'stress'),
        os.path.join(cassandra_dir, 'tools', 'bin', 'stress'),
        os.path.join(cassandra_dir, 'tools', 'bin', 'cassandra-stress')
    ]
    candidates = [common.platform_binary(s) for s in candidates]

    for candidate in candidates:
        if os.path.exists(candidate):
            stress = candidate
            break
    else:
        raise Exception("Cannot find stress binary (maybe it isn't compiled)")

    # make sure it's executable -> win32 doesn't care
    if sys.platform == "cygwin":
        # Yes, we're unwinding the path join from above.
        path = parse_path(stress)
        short_bin = parse_bin(stress)
        add_exec_permission(path, short_bin)
    elif not os.access(stress, os.X_OK):
        try:
            # try to add user execute permissions
            # os.chmod doesn't work on Windows and isn't necessary unless in cygwin...
            if sys.platform == "cygwin":
                common.add_exec_permission(path, stress)
            else:
                os.chmod(stress, os.stat(stress).st_mode | stat.S_IXUSR)
        except:
            raise Exception("stress binary is not executable: %s" % (stress, ))

    return stress