def AssignGroupNodes(r, group, nodes, force=False, dry_run=False):
    """
    Assigns nodes to a group.

    @type group: string
    @param group: Node gropu name
    @type nodes: list of strings
    @param nodes: List of nodes to assign to the group

    @rtype: int
    @return: job id

    """

    query = {
        "force": force,
        "dry-run": dry_run,
    }

    body = {
        "nodes": nodes,
    }

    return r.request("put", "/2/groups/%s/assign-nodes" % group, query=query,
                     content=body)