See questions at end...
For RH & CentOS builds, a profile's kickstart template goes through macro
processing
that allows it to access xCAT attribute values.
For a long time it bugged me that postscripts don't go through the same macro
processing, until
a colleague pointed out that it should be possible for postscripts to use curl
to pull any
attributes they need during the install. Very nice xCAT feature!! Here's
one possible postscript that could
be called by other postscripts to load a node's attributes into the current
shell environment:
/install/postscripts/getnodeattr:
ATTRF=/var/log/xcat/attr.$NODE
mkdir -p $(dirname $ATTRF)
if [ ! -f $ATTRF ] ; then
curl -k
https://$MASTER/xcatws/nodes/$NODE?userName=wsuser&password=wspd > $ATTRF.xml
||
exit 8
fi
# Convert
# <tr><td>addkcmdline</td><td>sshd</td></tr>
# to
# export ATTR_addkcmdline="sshd"
#
sed -e '/^<[/]*table/d' \
-e "s/<tr><td>/export ATTR_/" \
-e 's;</td><td>;=";' \
-e 's;</td></tr>;";' < ${ATTRF}.xml > $ATTRF
# load into the environment
. $ATTRF || exit 7
To use this, one would call: ". /xcatpost/getnodeattr"
from within a postscript. The wsuser user and policy must, of course, be set
up first.
Question 1. Is there any reason not to use curl and the REST API from
postscripts during an install? Does this duplicate existing xCAT
functionality?
Question 2. It's difficult to protect the "wsuser" password coded into
/install/postscripts/getnodeattr. The file can't be made read-only root, for
example, because httpd needs to be able to read it. Is there a way to limit
"wsuser" to GET calls?
Thanks,
Goran
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
xCAT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xcat-user