def apply_pack_owner_group(pack_path):
    """
    Switch owner group of the pack / virtualenv directory to the configured
    group.

    NOTE: This requires sudo access.
    """
    pack_group = utils.get_pack_group()

    if pack_group:
        LOG.debug(
            'Changing owner group of "{}" directory to {}'.format(pack_path, pack_group)
        )

        if SUDO_BINARY:
            args = ["sudo", "chgrp", "-R", pack_group, pack_path]
        else:
            # Environments where sudo is not available (e.g. docker)
            args = ["chgrp", "-R", pack_group, pack_path]

        exit_code, _, stderr, _ = shell.run_command(args)

        if exit_code != 0:
            # Non fatal, but we still log it
            LOG.debug(
                'Failed to change owner group on directory "{}" to "{}": {}'.format(
                    pack_path, pack_group, stderr
                )
            )

    return True

    Switch owner group of the pack / virtualenv directory to the configured
    group.

    NOTE: This requires sudo access.
    
st2common/st2common/util/pack_management.py