Skip to content

Commit

Permalink
Merge pull request #694 from ncharles/bug_5648/dev/exclude_server_wit…
Browse files Browse the repository at this point in the history
…h_roles

Fixes #5648: Don't include Rudder server component in results by default
  • Loading branch information
fanf committed Dec 5, 2014
2 parents 9fe52b8 + 322c941 commit b3001b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,20 @@ class AccepetedNodesLDAPQueryProcessor(
}
}

//filter out policy server if necessary
//filter out Rudder server component if necessary

query.returnType match {
case NodeReturnType =>
val withoutPolicyServer = inNodes.filterNot { case QueryResult(e, _, _) => e.isA(OC_POLICY_SERVER_NODE)}
// we have a special case for the root node that always never to that group, even if some weird
// scenario lead to the removal (or non addition) of them
val withoutServerRole = inNodes.filterNot { case QueryResult(e, inv, _) => (inv.valuesFor(A_SERVER_ROLE).size>0 || e(A_NODE_UUID) == Some("root")) }
if(logger.isDebugEnabled) {
val filtered = (inNodes.flatMap { case QueryResult(e, _, _) => e(A_NODE_UUID) }).toSet -- withoutPolicyServer.flatMap { case QueryResult(e, _, _) => e(A_NODE_UUID) }
val filtered = (inNodes.flatMap { case QueryResult(e, _, _) => e(A_NODE_UUID) }).toSet -- withoutServerRole.flatMap { case QueryResult(e, _, _) => e(A_NODE_UUID) }
if(!filtered.isEmpty) {
logger.debug("[%s] [post-filter:policyServer] %s results".format(debugId, withoutPolicyServer.size, filtered.mkString(", ")))
logger.debug("[%s] [post-filter:policyServer] %s results".format(debugId, withoutServerRole.size, filtered.mkString(", ")))
}
}
withoutPolicyServer
withoutServerRole
case NodeAndPolicyServerReturnType => inNodes
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class SearchNodeComponent(
def displayQuery(html: NodeSeq ) : NodeSeq = {
val Query(otName,comp, criteria) = query.get
SHtml.ajaxForm(bind("query", html,
"typeQuery" -> <label>Include policy servers: <span class="compositionCheckbox">{SHtml.checkbox(rType==NodeAndPolicyServerReturnType, { value:Boolean =>
"typeQuery" -> <label>Include Rudder server components: <span class="compositionCheckbox">{SHtml.checkbox(rType==NodeAndPolicyServerReturnType, { value:Boolean =>
if (value)
rType = NodeAndPolicyServerReturnType
else
Expand Down

0 comments on commit b3001b0

Please sign in to comment.