I am working on a scripting driver (BASH) that will perform a REST call
to one of our internal API's and I'm having some trouble with getting it
to read some of the attributes I'm sending for a query. I am declaring
my variables at the top of my script, and it is reading the CN fine,
however any additional attributes I define aren't being read. I've tried
removing some of the stuff in the script that I don't need for
troubleshooting, but here's what my query.sh looks like:

#!/bin/sh
# include the IDM Library
#. $IDMLIB
.. /opt/novell/usdrv/scripts/idmlib.sh

SearchName=`IDMGETVAR "SEARCH_ATTR_CN"`
API_SIGNATURE='IDMGETVAR "SEARCH_ATTR_API-SIGNATURE"'
URL='IDMGETVAR "SEARCH_ATTR_REST-URL"'
HEADER_1="Accept:text/xml"
HEADER_2="X-Api-Signature:$API_SIGNATURE"
HEADER_3="User-Agent: curl/7.19.7 (x86_64-suse-linux-gnu) libcurl/7.19.7
OpenSSL/0.9.8j zlib/1.2.3 libidn/1.10"
UTILITY=/usr/bin/curl
ATTRIBUTES='IDMGETVAR "SEARCH_ATTRS"'


echo $ATTRIBUTES
echo $SearchName
echo $API_SIGNATURE
echo $URL
echo $HEADER_1
echo $HEADER_2
echo $HEADER_3
echo $UTILITY

if [ -z "$SearchName" ]; then
STATUS_ERROR "Query: no search value"
else
Command="$UTILITY -i -v -H $HEADER_1 -H $HEADER_2 -H $HEADER_3 $URL"
Results=`$Command`
if [ -n "$Results" ]; then
IDMSETVAR "COMMAND" "INSTANCE"

STATUS_SUCCESS "Query succeeded"
else
# Return success with no results
STATUS_SUCCESS "Query succeeded (no matches)"
fi
fi


I'm getting this in the trace of the script:

IDMGETVAR "SEARCH_ATTRS"
joey.kinney
IDMGETVAR "SEARCH_ATTR_API-SIGNATURE"
IDMGETVAR "SEARCH_ATTR_REST-URL"
Accept:text/xml
X-Api-Signature:IDMGETVAR "SEARCH_ATTR_API-SIGNATURE"
User-Agent: curl/7.19.7 (x86_64-suse-linux-gnu) libcurl/7.19.7
OpenSSL/0.9.8j zlib/1.2.3 libidn/1.10
/usr/bin/curl
* getaddrinfo(3) failed for "SEARCH_ATTR_API-SIGNATURE":80
* Couldn't resolve host '"SEARCH_ATTR_API-SIGNATURE"'
* Closing connection #0

curl: (6) Couldn't resolve host '"SEARCH_ATTR_API-SIGNATURE"'
* getaddrinfo(3) failed for curl:80
* Couldn't resolve host 'curl'
* Closing connection #0

curl: (6) Couldn't resolve host 'curl'
* getaddrinfo(3) failed for (x86_64-suse-linux-gnu):80
* Couldn't resolve host '(x86_64-suse-linux-gnu)'
* Closing connection #0

curl: (6) Couldn't resolve host '(x86_64-suse-linux-gnu)'
* getaddrinfo(3) failed for libcurl:80
* Couldn't resolve host 'libcurl'
* Closing connection #0

curl: (6) Couldn't resolve host 'libcurl'
* getaddrinfo(3) failed for OpenSSL:80
* Couldn't resolve host 'OpenSSL'
* Closing connection #0

curl: (6) Couldn't resolve host 'OpenSSL'
* getaddrinfo(3) failed for zlib:80
* Couldn't resolve host 'zlib'
* Closing connection #0

curl: (6) Couldn't resolve host 'zlib'
* getaddrinfo(3) failed for libidn:80
* Couldn't resolve host 'libidn'
* Closing connection #0

curl: (6) Couldn't resolve host 'libidn'
* getaddrinfo(3) failed for IDMGETVAR:80
* Couldn't resolve host 'IDMGETVAR'
* Closing connection #0

curl: (6) Couldn't resolve host 'IDMGETVAR'
* getaddrinfo(3) failed for "SEARCH_ATTR_REST-URL":80
* Couldn't resolve host '"SEARCH_ATTR_REST-URL"'
* Closing connection #0

curl: (6) Couldn't resolve host '"SEARCH_ATTR_REST-URL"'


My XDS that's submitted to the shim looks this:

<nds ndsversion="8.x" dtdversion="4.0">
<source>
<product version="4.0.2.0" edition="Advanced">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<query scope="subtree" event-id="0">
<search-attr attr-name="CN">
<value>joey.kinney</value>
</search-attr>
<read-attr />
<search-attr attr-name="API-HASH">
<value type="string">987654321</value>
</search-attr>
<search-attr attr-name="API-SIGNATURE">
<value type="string">123456789:123456789curl/7.19.7
(x86_64-suse-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8j zlib/1.2.3
libidn/1.1020130911105015987654321</value>
</search-attr>
<search-attr attr-name="REST-URL">
<value type="string">http://api.test.com</value>
</search-attr>
</query>
</input>
</nds>


Any insight would be greatly appreciated.


JK


--
jkinney
------------------------------------------------------------------------
jkinney's Profile: https://forums.netiq.com/member.php?userid=296
View this thread: https://forums.netiq.com/showthread.php?t=48664