예제 #1
0
def check_diskspace(repo, min_free=None):
    if not min_free:
        min_free = global_config.global_config.get_config_value(
            'PACKAGES', 'minimum_free_space', type=int)
    try:
        df = repo_run_command(repo, 'df -mP . | tail -1').stdout.split()
        free_space_gb = int(df[3]) / 1000.0
    except Exception, e:
        raise error.RepoUnknownError('Unknown Repo Error: %s' % e)
예제 #2
0
def check_diskspace(repo, min_free=None):
    # Note: 1 GB = 10**9 bytes (SI unit).
    if min_free is None:
        min_free = global_config.global_config.get_config_value(
            'PACKAGES', 'minimum_free_space', type=int, default=1)
    try:
        df = repo_run_command(repo,
                              'df -PB %d . | tail -1' % 10**9).stdout.split()
        free_space_gb = int(df[3])
    except Exception, e:
        raise error.RepoUnknownError('Unknown Repo Error: %s' % e)