Highlighted
Trusted Contributor.
Trusted Contributor.
346 views

get association from source attribute

Jump to solution

Hi,

I need to get the assocation value from the current driver, from another object

The instance looks like this:

<nds dtdversion="4.0" ndsversion="8.x">
  <source>
    <product edition="Advanced" version="4.8.1.0">DirXML</product>
    <contact>NetIQ Corporation</contact>
  </source>
  <output>
    <instance class-name="Group" qualified-src-dn="O=data\OU=groups\OU=NAM\CN=NAM Admins" src-dn="\BLACKPILL\data\groups\NAM\NAM Admins" src-entry-id="56670">
      <association state="associated">cn=nam admins,ou=nam,o=novell</association>
      <attr attr-name="DirXML-Associations">
        <value timestamp="1597228757#22" type="structured">
          <component name="nameSpace">1</component>
          <component name="volume">\BLACKPILL\system\driverset1\Data Collection Service Driver</component>
          <component name="path">AA985E45-C019-ae47-BC4E-AA985E45C019</component>
        </value>
        <value timestamp="1597228757#27" type="structured">
          <component name="nameSpace">1</component>
          <component name="volume">\BLACKPILL\system\driverset1\NULL-ReferenceAndAttrClean01</component>
          <component name="path">qpheRcAZrke8TqqYXkXAGQ==</component>
        </value>
        <value timestamp="1597228757#32" type="structured">
          <component name="nameSpace">1</component>
          <component name="volume">\BLACKPILL\system\driverset1\NULL-Advis01</component>
          <component name="path">qpheRcAZrke8TqqYXkXAGQ==</component>
        </value>
        <value timestamp="1597330165#1" type="structured">
          <component name="nameSpace">1</component>
          <component name="volume">\BLACKPILL\system\driverset1\NAM Administration</component>
          <component name="path">cn=nam admins,ou=nam,o=novell</component>
        </value>
      </attr>
    </instance>
    <status level="success"></status>
  </output>
</nds>

 

I've tried a lot of things. For example (here lAssocs is the nodeset variable with the instance)

<do-for-each>
	<arg-node-set>
		<token-xpath expression="$lAssocs/attr/value"/>
	</arg-node-set>
	<arg-actions>
		<do-if>
			<arg-conditions>
				<and>
					<if-xpath op="true">$current-node/component[@name='volume']/text()=$dirxml.auto.driverdn</if-xpath>
					<if-xpath op="true">$current-node/component[@name='nameSpace']/text()='1'</if-xpath>
				</and>
			</arg-conditions>
			<arg-actions>
				<do-set-local-variable name="lObjAssoc" scope="policy">
					<arg-string>
						<token-xpath expression="$lAssoc/component[@name='path']/text()"/>
					</arg-string>
				</do-set-local-variable>
			</arg-actions>
			<arg-actions/>
		</do-if>
		<do-trace-message>
			<arg-string>
				<token-text xml:space="preserve">MYASSOC:</token-text>
				<token-local-variable name="lObjAssoc"/>
			</arg-string>
		</do-trace-message>
	</arg-actions>
</do-for-each>

 

Can anyone tell me why I fail? Or even better, how to do it?

1 Solution

Accepted Solutions
Highlighted
Knowledge Partner
Knowledge Partner

If I read this correctly, you want the association for the Group object, to this driver?

 

If so, $IAssocs/association will get it from the <intsance> doc if you use a Query token to store it in the nodeset variable example as above?

No need to parse the DirXML-Associations object. 

View solution in original post

7 Replies
Highlighted
Knowledge Partner
Knowledge Partner
Change:
<if-xpath op="true">$current-node/component[@name='nameSpace']/text()='1'</if-xpath>

To:
<if-xpath op="true">$current-node/component[@name='nameSpace']='1'</if-xpath>

I think that will do it.
Highlighted
Knowledge Partner
Knowledge Partner
What I suggest is that you try without the /text() part when testing inside the for loop. I don't know why buy for me that worked.
Highlighted
Knowledge Partner
Knowledge Partner

If I read this correctly, you want the association for the Group object, to this driver?

 

If so, $IAssocs/association will get it from the <intsance> doc if you use a Query token to store it in the nodeset variable example as above?

No need to parse the DirXML-Associations object. 

View solution in original post

Highlighted
Trusted Contributor.
Trusted Contributor.

Thanks to both of you.

A working version goes like this:

<do-set-local-variable name="lAssocs" scope="policy">
	<arg-node-set>
		<token-query class-name="Group" datastore="src">
			<arg-dn>
				<token-local-variable name="current-node"/>
			</arg-dn>
			<arg-string>
				<token-text xml:space="preserve">DirXML-Associations</token-text>
			</arg-string>
		</token-query>
	</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="lAssoc" scope="policy">
	<arg-string>
		<token-xpath expression="$lAssocs/association"/>
	</arg-string>
</do-set-local-variable>
<do-trace-message>
	<arg-string>
		<token-text xml:space="preserve">MYASSOC</token-text>
		<token-local-variable name="lAssoc"/>
	</arg-string>
</do-trace-message>

 

 

Highlighted
Knowledge Partner
Knowledge Partner

Some more fun to your original approach. In IDM 4.7.something they changed the engine so that queries for Path syntax attributes (DirXML-EntitlementRef was the main target, but it apparently spilled over to all Path syntax fields, so DirXML-Associations, nrfEntitlementRef, and maybe more) will now ONLY return the ones whose volume component matches the current driver. So you could not in DriverA query Associations to try and get the assoc on the user to DriverB. 


Their is an ECV to turn this off. Which is useful.

Highlighted
Micro Focus Expert
Micro Focus Expert

Can't you just use resolve?

<token-resolve> resolves the the DN specified by <arg-dn> to an association key, or the association key specified by <arg-association> to a DN in the datastore specified by datastore.

--
Norbert
Highlighted
Trusted Contributor.
Trusted Contributor.

That was indeed a mighty fine idea.

I'll try that (or else I will forget about it, and won't be able to remember to use it next time)

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.