if (hasattr(match_options,option_name)):
context = p.xpathEval("//rule/argument[name='%s']"%option_name)
+ import pdb
+ pdb.set_trace()
if (not context):
raise Exception('Unknown option %s for match %s'%(option,option['name']))
else:
-->
<match name="hrn">
- <context select="//sfa//user/hrn"/>
+ <!-- Empty context. We _always_ get the hrn of the current user -->
+ <context select="//sfa/current/user@hrn"/>
<rule>
<argument>
<name>user-hrn</name>
--- /dev/null
+<target name="RESTRICT_TO_NODES">
+ <!-- The context is empty, since this target does not require any input from SFA -->
+ <context select=""/>
+ <rule>
+ <argument>
+ <name>whitelist</name>
+ <help>Prefix of nodes to whitelist for this match.</help>
+ <operand>PREFIX</operand>
+ </argument>
+ <argument>
+ <name>blacklist</name>
+ <help>Prefix of nodes to blacklist for this match.</help>
+ <operand>PREFIX</operand>
+ </argument>
+
+ </rule>
+ <processor filename="restrict_to_nodes.xsl"/>
+</match>
--- /dev/null
+<target name="RESTRICT_TO_NODE_GROUP">
+ <!-- In this case, we need the list of nodes in the [white,black]-listed nodegroups. We specify these with an XPath expression.
+ The expression can have SFA variables, specified using the prefix '%' -->
+ <context select="//sfa/nodes/node[name=%whitelist]/@name" name="whitelist"/>
+ <context select="//sfa/nodes/node[name=%blacklist]/@name" name="blacklist"/>
+ <rule>
+ <argument>
+ <name>whitelist</name>
+ <help>Name of whitelisted node group</help>
+ <operand>NODE-GROUP</operand>
+ </argument>
+ <argument>
+ <name>blacklist</name>
+ <help>Name of the blacklisted node group</help>
+ <operand>NODE-GROUP</operand>
+ </argument>
+ </rule>
+ <processor filename="restrict_to_nodes.xsl"/>
+</match>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!-- This is an aggregate-specific target for the PL aggregate.
- Its function is to drop nodes that do not match the user-specified pattern.
--->
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <xsl:variable name="result">
- <xsl:for-each select="//rspec-match/context-input//nodespec">
- <xsl:variable name="context-hostname" select="hostname"/>
- <xsl:for-each select="//rspec-match/rule-input//user">
- <xsl:choose>
- <xsl:when test="starts-with($context-hrn, hrn)">
- True
- </xsl:when>
- <xsl:otherwise>
- False
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="$result"/>
- </xsl:template>
-</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="/">
+ <xsl:variable name="whitelist_prefix" select="//rule/argument[name='whitelist']/value"/>
+ <xsl:variable name="nodes_minus_whitelist" select="//request/nodespec/node"/>
+ <xsl:value-of select="$nodes_minus_whitelist"/>
+ </xsl:template>
+</xsl:stylesheet>