Esempio n. 1
0
def mock_os_disk_stats(folder):
    used, total = os.path.basename(folder).split(',')

    used_bytes = parse_size(used)
    total_bytes = parse_size(total)
    free_bytes = total_bytes - used_bytes

    return free_bytes, total_bytes
def mock_os_disk_stats(folder):
    used, total = os.path.basename(folder).split(',')

    used_bytes = parse_size(used)
    total_bytes = parse_size(total)
    free_bytes = total_bytes - used_bytes

    return free_bytes, total_bytes
Esempio n. 3
0
    def on_task_metainfo(self, task, config):
        selector = selector_map[config["select"]]

        # Convert within to bytes (int) or percent (float)
        within = config.get("within")
        if isinstance(within, basestring) and "%" in within:
            within = parse_percent(within)
        else:
            within = parse_size(within)

        path = selector(config["paths"], within=within)

        if path:
            log.debug("Path %s selected due to (%s)" % (path, config["select"]))

            for entry in task.all_entries:
                entry[config["to_field"]] = path
        else:
            task.abort("Unable to select a path based on %s" % config["select"])
            return
Esempio n. 4
0
    def on_task_metainfo(self, task, config):
        selector = selector_map[config['select']]

        # Convert within to bytes (int) or percent (float)
        within = config.get('within')
        if isinstance(within, basestring) and '%' in within:
            within = parse_percent(within)
        else:
            within = parse_size(within)

        path = selector(config['paths'], within=within)

        if path:
            log.debug('Path %s selected due to (%s)' % (path, config['select']))

            for entry in task.all_entries:
                entry[config['to_field']] = path
        else:
            task.abort('Unable to select a path based on %s' % config['select'])
            return
Esempio n. 5
0
    def on_task_metainfo(self, task, config):
        selector = selector_map[config['select']]

        # Convert within to bytes (int) or percent (float)
        within = config.get('within')
        if isinstance(within, str) and '%' in within:
            within = parse_percent(within)
        else:
            within = parse_size(within)

        path = selector(config['paths'], within=within)

        if path:
            logger.debug('Path {} selected due to ({})', path, config['select'])

            for entry in task.all_entries:
                entry[config['to_field']] = path
        else:
            task.abort('Unable to select a path based on %s' % config['select'])
            return