Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Fixes #28076: Pending nodes in LDAP doesn't show up in webapp#6829

Merged
fanf merged 1 commit intoNormation:branches/rudder/8.3from
fanf:bug_28076/pending_nodes_in_ldap_doesn_t_show_up_in_webapp
Jan 9, 2026
Merged

Fixes #28076: Pending nodes in LDAP doesn't show up in webapp#6829
fanf merged 1 commit intoNormation:branches/rudder/8.3from
fanf:bug_28076/pending_nodes_in_ldap_doesn_t_show_up_in_webapp

Conversation

@fanf
Copy link
Member

@fanf fanf commented Jan 8, 2026

https://issues.rudder.io/issues/28076

So, the root problem was that we were counting entries in LDAP branch ou=PendingNodes,..., but that is not correct since we switched to CoreNodeFactRepository : now, a pending node needs to have an entry in both ou=PendingNodes,... and ou=Nodes, ... like an accepted node.

So we were in the case where these nodes only had half the needed content. I haven't the least idea HOW we get there, but in any case, when we only have something in ou=Pending Nodes, we should ignore it - which is correctly done by NodeFactRepo.

More over, that way of doing things was ignoring tenants, which is not good.

So, the correction is just to replace the compliacte LDAP request by factRepo.giveMePendingNodes.count (more or less, actual syntaxt is not that).

I also cleaned up other bit that were extremely complicated for no apparent reason - some code dating back from 2014, so perhaps it was relevant in that anticated times, but not now with the node fact repos.

@fanf fanf requested a review from clarktsiory January 8, 2026 14:37

object nodeFacts extends RequestVar[MapView[NodeId, CoreNodeFact]](initNodeInfos()(CurrentUser.queryContext))
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that doesn't seems usefull anymore. I think it was done because once upon a time, I took a lot of time to query these info. Plus, we wanted to have the same data for the whole page.
But now, it can be done with just a nodeFactRepo.getAll() and pass the result around as a parameter.

}

def pendingNodes(html: NodeSeq): NodeSeq = {
displayCount(() => countPendingNodes(), "pending nodes")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need that to be lazily evaluated, because nothing is async nor be evaluated in a ZIO context

private def countPendingNodes(): Box[Int] = {
ldap.flatMap(con => con.searchOne(pendingNodesDit.NODES.dn, ALL, "1.1")).map(x => x.size)
private def countPendingNodes(implicit qc: QueryContext): Box[Int] = {
nodeFactRepo.getAll()(qc, SelectNodeStatus.Pending).map(_.size)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is the actual bug correction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be painful for upmerge, since Scala 3 requires getAll()(using qc, SelectNodeStatus.Pending) (or even getAll(using status = SelectNodeStatus.Pending)) 😅

I don't know if I would prefer defining a new implicit val select: SelectNodeStatus = SelectNodeStatus.pending to avoid that upmerge... (I prefer Scala 3 myself 😸)

Copy link
Contributor

@clarktsiory clarktsiory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ! The may be some upmerge with Scala 3 using...

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/6829
-- Your faithful QA
Kant merge: "Thoughts without content are empty, intuitions without concepts are blind."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/112266/console)

@fanf
Copy link
Member Author

fanf commented Jan 9, 2026

OK, merging this PR

@fanf fanf merged commit 5effbf5 into Normation:branches/rudder/8.3 Jan 9, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments