def apply(inputhashes, log):
    """
    Adds the group to the system. If the group is currently present, it fails
    as we can't yet modify groups.
    """
    failed = []
    for group in inputhashes:
        name = group['name']
        try:
            result = grp.getgrnam(name)
            # Can't modify groups that already exist...yet
            log.error('Group %s already present, can\'t modify', name)
            failed.append(group)
        except __HOLE__:
            # this is the normal path
            args = ['groupadd']

            if 'system' in group:
                if bool(group['system']):
                    args.append('--system')
            if 'gid' in group:
                args.append('--gid')
                args.append(group['gid'])

            args.append(name)
            result = subprocess.call(args)
            log.debug('groupadd for %s result %s', args, result)

            if result != 0:
                failed.append(group)

    return failed
dataset/ETHPy150Open gosquadron/squadron/squadron/libraries/group/__init__.py/apply