Skip to content
This repository
Browse code

ctx-agent/ from 2009-01-10

  • Loading branch information...
commit 67dffb673896f68b914857dfd4742f59997c252f 1 parent 80433cc
Tim Freeman timf authored

Showing 41 changed files with 7,224 additions and 0 deletions. Show diff stats Hide diff stats

  1. +17 0 ctx-agent/ctx-scripts/0-etchosts.sh
  2. +37 0 ctx-agent/ctx-scripts/1-ipandhost/nfsclient
  3. +35 0 ctx-agent/ctx-scripts/1-ipandhost/nfsserver
  4. +23 0 ctx-agent/ctx-scripts/1-ipandhost/testrole1
  5. +23 0 ctx-agent/ctx-scripts/1-ipandhost/testrole2
  6. +23 0 ctx-agent/ctx-scripts/1-ipandhost/testrole3
  7. +33 0 ctx-agent/ctx-scripts/1-ipandhost/torquemaster
  8. +37 0 ctx-agent/ctx-scripts/1-ipandhost/torqueslave
  9. +89 0 ctx-agent/ctx-scripts/2-thishost/publicnic
  10. +24 0 ctx-agent/ctx-scripts/3-data/gridmap
  11. +25 0 ctx-agent/ctx-scripts/3-data/startcontainer
  12. +27 0 ctx-agent/ctx-scripts/3-data/testdata
  13. +31 0 ctx-agent/ctx-scripts/4-restarts/nfsclient
  14. +49 0 ctx-agent/ctx-scripts/4-restarts/nfsserver
  15. +21 0 ctx-agent/ctx-scripts/4-restarts/testrole2
  16. +20 0 ctx-agent/ctx-scripts/4-restarts/torquemaster
  17. +21 0 ctx-agent/ctx-scripts/4-restarts/torqueslave
  18. +94 0 ctx-agent/ctx-scripts/5-thishost-finalize/publicnic
  19. +21 0 ctx-agent/ctx-scripts/clean.sh
  20. +9 0 ctx-agent/ctx-scripts/problem.sh
  21. +178 0 ctx-agent/ctx/ctx.conf
  22. +10 0 ctx-agent/ctx/launch.sh
  23. +37 0 ctx-agent/ctx/lib/err-template-001.xml
  24. +45 0 ctx-agent/ctx/lib/err-template-002.xml
  25. +40 0 ctx-agent/ctx/lib/ok-template-001.xml
  26. +40 0 ctx-agent/ctx/lib/ok-template-002.xml
  27. +141 0 ctx-agent/ctx/lib/pylib/embeddedET/ElementInclude.py
  28. +196 0 ctx-agent/ctx/lib/pylib/embeddedET/ElementPath.py
  29. +1,254 0 ctx-agent/ctx/lib/pylib/embeddedET/ElementTree.py
  30. +230 0 ctx-agent/ctx/lib/pylib/embeddedET/HTMLTreeBuilder.py
  31. +103 0 ctx-agent/ctx/lib/pylib/embeddedET/SgmlopXMLTreeBuilder.py
  32. +144 0 ctx-agent/ctx/lib/pylib/embeddedET/SimpleXMLTreeBuilder.py
  33. +279 0 ctx-agent/ctx/lib/pylib/embeddedET/SimpleXMLWriter.py
  34. +6 0 ctx-agent/ctx/lib/pylib/embeddedET/TidyHTMLTreeBuilder.py
  35. +128 0 ctx-agent/ctx/lib/pylib/embeddedET/TidyTools.py
  36. +113 0 ctx-agent/ctx/lib/pylib/embeddedET/XMLTreeBuilder.py
  37. +30 0 ctx-agent/ctx/lib/pylib/embeddedET/__init__.py
  38. +34 0 ctx-agent/ctx/lib/retr-template-001.xml
  39. +42 0 ctx-agent/ctx/lib/retr-template-002.xml
  40. +3,494 0 ctx-agent/ctx/lib/workspace_ctx_retrieve.py
  41. +21 0 ctx-agent/ctx/sample-rc-local-entry.txt
17 ctx-agent/ctx-scripts/0-etchosts.sh
... ... @@ -0,0 +1,17 @@
  1 +#!/bin/sh
  2 +
  3 +# This configures the local /etc/hosts file with all members of the context.
  4 +# Don't change or delete this script unless you know what you are doing.
  5 +
  6 +echo ""
  7 +echo "etchosts script"
  8 +echo "IP: $1"
  9 +echo "Short hostname: $2"
  10 +echo "Hostname: $3"
  11 +
  12 +echo "$1 $3 $2" >> /etc/hosts
  13 +
  14 +
  15 +exit 0
  16 +
  17 +
37 ctx-agent/ctx-scripts/1-ipandhost/nfsclient
... ... @@ -0,0 +1,37 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "NFS client required: we are being told this node requires an NFS client,"
  18 +echo "therefore it will be playing the role of NFS server."
  19 +echo ""
  20 +
  21 +# This script configures the NFS server exports policy to allow the one client
  22 +# it's now hearing about to import the exported volumes.
  23 +
  24 +echo "NFS CLIENT IP: $1"
  25 +echo "NFS CLIENT Short hostname: $2"
  26 +echo "NFS CLIENT Hostname: $3"
  27 +
  28 +EXPORTS="/etc/exports"
  29 +
  30 +# append IP to every non-empty line in EXPORTS
  31 +RESULT="`sed -e \"s/ \$/ $1(rw,no_root_squash) /\" $EXPORTS`"
  32 +
  33 +echo "$RESULT" > "$EXPORTS"
  34 +
  35 +exit 0
  36 +
  37 +
35 ctx-agent/ctx-scripts/1-ipandhost/nfsserver
... ... @@ -0,0 +1,35 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "NFS server required: we are being told this node requires an NFS server,"
  18 +echo "therefore it will be playing the role of an NFS client."
  19 +echo ""
  20 +
  21 +# This script configures the fstab file to list an import from this server node
  22 +# we are hearing about. Repeat below for each volume to import. If you have
  23 +# multiple NFS servers, each exporting something different, make sure you have
  24 +# DIFFERENT role names for each (like "nfsserver1" "nfsserver2" etc).
  25 +
  26 +echo "NFS SERVER IP: $1"
  27 +echo "NFS SERVER Short hostname: $2"
  28 +echo "NFS SERVER Hostname: $3"
  29 +
  30 +echo "$1:/home /home nfs tcp,rsize=32768,wsize=32768,intr,soft,user,exec 0 0" >> /etc/fstab
  31 +echo "$1:/etc/grid-security/certificates /etc/grid-security/certificates nfs tcp,rsize=32768,wsize=32768,intr,soft,user,exec 0 0" >> /etc/fstab
  32 +
  33 +exit 0
  34 +
  35 +
23 ctx-agent/ctx-scripts/1-ipandhost/testrole1
... ... @@ -0,0 +1,23 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "TESTROLE1 IP: $1"
  18 +echo "TESTROLE1 Short hostname: $2"
  19 +echo "TESTROLE1 Hostname: $3"
  20 +
  21 +echo -e "Testing: testrole1 is provided by host $3 \n" >> /tmp/testrole1
  22 +
  23 +
23 ctx-agent/ctx-scripts/1-ipandhost/testrole2
... ... @@ -0,0 +1,23 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "TESTROLE2 IP: $1"
  18 +echo "TESTROLE2 Short hostname: $2"
  19 +echo "TESTROLE2 Hostname: $3"
  20 +
  21 +echo -e "Testing: testrole2 is provided by host $3 \n" >> /tmp/testrole2
  22 +
  23 +
23 ctx-agent/ctx-scripts/1-ipandhost/testrole3
... ... @@ -0,0 +1,23 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "TESTROLE3 IP: $1"
  18 +echo "TESTROLE3 Short hostname: $2"
  19 +echo "TESTROLE3 Hostname: $3"
  20 +
  21 +echo -e "Testing: testrole3 is provided by host $3 \n" >> /tmp/testrole3
  22 +
  23 +
33 ctx-agent/ctx-scripts/1-ipandhost/torquemaster
... ... @@ -0,0 +1,33 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "Torque master required: we are being told this node requires a Torque"
  18 +echo "master, therefore it will be playing the role of Torque slave."
  19 +echo ""
  20 +
  21 +echo "TORQUEMASTER IP: $1"
  22 +echo "TORQUEMASTER Short hostname: $2"
  23 +echo "TORQUEMASTER Hostname: $3"
  24 +
  25 +# Configure the Torque server name to enslave to. Replace the file contents,
  26 +# do not append since only one can be handled. It would be a misconfiguration
  27 +# to have more than one node playing the torquemaster role in a context.
  28 +
  29 +echo "\$pbsserver $3" > /var/spool/torque/mom_priv/config
  30 +echo "$3" > /var/spool/torque/server_name
  31 +
  32 +exit 0
  33 +
37 ctx-agent/ctx-scripts/1-ipandhost/torqueslave
... ... @@ -0,0 +1,37 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 1-ipandhost scripts are called when the context broker tells this node it #
  5 +# *requires* to know about nodes playing the role. If this node is told it #
  6 +# requires to know about nodes playing the "xyz" role, then if a script #
  7 +# called "xyz" lives in this directory, it will be called with IP, short #
  8 +# hostname and hostname (args $1, $2, and $3 respectively) of the node that #
  9 +# *provides* the required "xyz" role. #
  10 +# ************************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "Torque slave required: we are being told this node requires a Torque"
  18 +echo "slave, therefore it will be playing the role of Torque master."
  19 +echo ""
  20 +
  21 +echo "TORQUESLAVE IP: $1"
  22 +echo "TORQUESLAVE Short hostname: $2"
  23 +echo "TORQUESLAVE Hostname: $3"
  24 +
  25 +# Add this node we are hearing about to the nodes list. For every node that
  26 +# provides the torqueslave role, this script will be called. Therefore we
  27 +# APPEND (not replace) to this nodes file:
  28 +
  29 +echo "$2 np=2" >> /var/spool/torque/server_priv/nodes
  30 +
  31 +
  32 +# This is a trick to send a message to another script:
  33 +touch /root/this_node_is_torque_master
  34 +
  35 +exit 0
  36 +
  37 +
89 ctx-agent/ctx-scripts/2-thishost/publicnic
... ... @@ -0,0 +1,89 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************ #
  4 +# 2-thishost scripts are called with *this* node's IP, short hostname and #
  5 +# fully qualified hostname. It can be useful in multi NIC situations #
  6 +# especially. #
  7 +# ************************************************************************ #
  8 +
  9 +RELDIR=`dirname $0`
  10 +ABSDIR=`cd $RELDIR; pwd`
  11 +echo "Hello from \"$ABSDIR/$0\""
  12 +
  13 +# NOTE: The name of this script must correspond to the interface name that
  14 +# the context broker knows, not the local interface name which may or
  15 +# may not match.
  16 +#
  17 +# The context agent can only handle two NICs at most. By convention, if
  18 +# there is more than one NIC, the nics need to be labelled "publicnic" or
  19 +# "localnic" as defined by the metadata server. On EC2, the publicnic
  20 +# is the public IP address that NATs the VM (it does not correspond to
  21 +# an actual NIC in the VM). Note again that the labelling is NOT the
  22 +# interface name in the VM but rather the labels in the contextualization
  23 +# document where different roles may be played by different IP addresses
  24 +# (and they are labelled with NIC names).
  25 +
  26 +echo "publicnic thishost script: configuring local programs before restarts"
  27 +
  28 +echo "This IP: $1"
  29 +echo "This short local hostname: $2"
  30 +echo "This FQDN: $3"
  31 +
  32 +
  33 +# SSH host based authentication was configured already, restart SSH to load
  34 +# new config.
  35 +
  36 +/etc/init.d/sshd restart
  37 +
  38 +# We're overloading torque master role to imply other head node setups.
  39 +# Could do something explicit too.
  40 +if [ ! -e "/root/this_node_is_torque_master" ]; then
  41 + exit 0
  42 +fi
  43 +
  44 +
  45 +# For torque, replace entire contents of these files
  46 +echo "$3" > /var/spool/torque/server_name
  47 +echo "root@$3" > /var/spool/torque/server_priv/acl_svr/operators
  48 +
  49 +
  50 +# Create a self-signed cert for onboard CA operations
  51 +/root/bin/ca.sh $3 > /root/safe/host.0
  52 +if [ $? -ne 0 ]; then
  53 + echo "failed to make onboard trust root"
  54 + exit 1
  55 +fi
  56 +
  57 +
  58 +# node should trust itself. We need to get the cert hash for the
  59 +# filename first:
  60 +HASH=`openssl x509 -in /root/safe/host.0 -hash -noout`
  61 +CAFILE="/etc/grid-security/certificates/$HASH.0"
  62 +cp /root/safe/host.0 $CAFILE
  63 +echo "New 'CA' cert: $CAFILE"
  64 +
  65 +# for user pickup
  66 +cp $CAFILE /root/certs/
  67 +
  68 +function makefile (){
  69 + touch $3
  70 + chown $1 $3
  71 + chmod $2 $3
  72 +}
  73 +
  74 +makefile root 444 /etc/grid-security/hostcert.pem
  75 +cp /root/safe/host.0 /etc/grid-security/hostcert.pem
  76 +makefile root 400 /etc/grid-security/hostkey.pem
  77 +cp /root/safe/host.key /etc/grid-security/hostkey.pem
  78 +
  79 +makefile globus 444 /etc/grid-security/containercert.pem
  80 +cp /root/safe/host.0 /etc/grid-security/containercert.pem
  81 +makefile globus 400 /etc/grid-security/containerkey.pem
  82 +cp /root/safe/host.key /etc/grid-security/containerkey.pem
  83 +
  84 +
  85 +
  86 +
  87 +
  88 +
  89 +
24 ctx-agent/ctx-scripts/3-data/gridmap
... ... @@ -0,0 +1,24 @@
  1 +#!/bin/sh
  2 +
  3 +# ******************************************************************* #
  4 +# 3-data scripts have filenames that correspond to data names in the #
  5 +# context. If this node is told it requires data 'xyz' and a script #
  6 +# in the 3-data directory bears the name 'xyz' then it is called. #
  7 +# The data value has already been written out to a temporary file. #
  8 +# The absolute path of that file is given as argument $1 to this #
  9 +# script for you to do as you please. #
  10 +# ******************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "'gridmap' data"
  18 +echo "Filename with data value: $1"
  19 +
  20 +echo "Copying that to /etc/grid-security/grid-mapfile"
  21 +
  22 +cp $1 /etc/grid-security/grid-mapfile
  23 +
  24 +
25 ctx-agent/ctx-scripts/3-data/startcontainer
... ... @@ -0,0 +1,25 @@
  1 +#!/bin/sh
  2 +
  3 +# ******************************************************************* #
  4 +# 3-data scripts have filenames that correspond to data names in the #
  5 +# context. If this node is told it requires data 'xyz' and a script #
  6 +# in the 3-data directory bears the name 'xyz' then it is called. #
  7 +# The data value has already been written out to a temporary file. #
  8 +# The absolute path of that file is given as argument $1 to this #
  9 +# script for you to do as you please. #
  10 +# ******************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "Filename with data value: $1"
  18 +
  19 +echo "This is being used as an example of how one could do a trigger. The "
  20 +echo "presence of this data in the context tells us to indeed start the "
  21 +echo "container."
  22 +
  23 +# This "sends a message" to another script:
  24 +touch /root/do_startcontainer
  25 +
27 ctx-agent/ctx-scripts/3-data/testdata
... ... @@ -0,0 +1,27 @@
  1 +#!/bin/sh
  2 +
  3 +# ******************************************************************* #
  4 +# 3-data scripts have filenames that correspond to data names in the #
  5 +# context. If this node is told it requires data 'xyz' and a script #
  6 +# in the 3-data directory bears the name 'xyz' then it is called. #
  7 +# The data value has already been written out to a temporary file. #
  8 +# The absolute path of that file is given as argument $1 to this #
  9 +# script for you to do as you please. #
  10 +# ******************************************************************* #
  11 +
  12 +RELDIR=`dirname $0`
  13 +ABSDIR=`cd $RELDIR; pwd`
  14 +echo "Hello from \"$ABSDIR/$0\""
  15 +
  16 +echo ""
  17 +echo "'testdata' example data script"
  18 +echo "Filename with data value: $1"
  19 +
  20 +echo "Copying that to /tmp/testdata-received"
  21 +
  22 +cp $1 /tmp/testdata-received
  23 +
  24 +# That tempfile will contain whatever was put into the context under
  25 +# this dataname.
  26 +
  27 +
31 ctx-agent/ctx-scripts/4-restarts/nfsclient
... ... @@ -0,0 +1,31 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 4-restarts scripts are a little counter-intuitive. If *requiring a role* #
  5 +# implies this node *plays a role*, you can base restarts off of this. #
  6 +# For example, if "pbsslave" is a required role, it implies this node is a #
  7 +# PBS server and the pbsslave restart script could restart the PBS daemon #
  8 +# since it's called after all the configuration is done (ipandhost scripts) #
  9 +# ************************************************************************* #
  10 +
  11 +RELDIR=`dirname $0`
  12 +ABSDIR=`cd $RELDIR; pwd`
  13 +echo "Hello from \"$ABSDIR/$0\""
  14 +
  15 +# This scripts is named "nfsclient" and is called if this node *requires*
  16 +# "nfsclient" role. If it requires "nfsclient" then it's an NFS server,
  17 +# restart the NFS server.
  18 +
  19 +echo "NFS client role needed: restart NFS server"
  20 +
  21 +/etc/init.d/nfs restart
  22 +
  23 +if [ $? -ne 0 ]; then
  24 + sleep 3
  25 + /etc/init.d/nfs restart
  26 + exit $?
  27 +fi
  28 +
  29 +exit 0
  30 +
  31 +
49 ctx-agent/ctx-scripts/4-restarts/nfsserver
... ... @@ -0,0 +1,49 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 4-restarts scripts are a little counter-intuitive. If *requiring a role* #
  5 +# implies this node *plays a role*, you can base restarts off of this. #
  6 +# For example, if "pbsslave" is a required role, it implies this node is a #
  7 +# PBS server and the pbsslave restart script could restart the PBS daemon #
  8 +# since it's called after all the configuration is done (ipandhost scripts) #
  9 +# ************************************************************************* #
  10 +
  11 +RELDIR=`dirname $0`
  12 +ABSDIR=`cd $RELDIR; pwd`
  13 +echo "Hello from \"$ABSDIR/$0\""
  14 +
  15 +# This scripts is named "nfsserver" and is called if this node *requires*
  16 +# "nfsserver" role. If it requires "nfsserver" then it's an NFS client,
  17 +# so initiate the client mounts here.
  18 +
  19 +echo "NFS server role needed, initiating NFS client mounts"
  20 +
  21 +# /etc/init.d/netfs restart and cousins are not as helpful as this.
  22 +
  23 +# Should add a feature in the future that fails out after so many attempts etc.
  24 +
  25 +function mountone (){
  26 + echo "Trying to mount $1"
  27 +
  28 + MOUNTED="no"
  29 +
  30 + while [ "$MOUNTED" = "no" ]; do
  31 + mount $1
  32 + if [ $? -eq 0 ]; then
  33 + MOUNTED="yes"
  34 + echo "$1 is now mounted"
  35 + else
  36 + echo "$1 not mounted, sleeping 3 seconds"
  37 + sleep 3
  38 + fi
  39 + done
  40 +}
  41 +
  42 +mountone "/home"
  43 +mountone "/etc/grid-security/certificates"
  44 +
  45 +
  46 +
  47 +
  48 +
  49 +
21 ctx-agent/ctx-scripts/4-restarts/testrole2
... ... @@ -0,0 +1,21 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 4-restarts scripts are a little counter-intuitive. If *requiring a role* #
  5 +# implies this node *plays a role*, you can base restarts off of this. #
  6 +# For example, if "pbsslave" is a required role, it implies this node is a #
  7 +# PBS server and the pbsslave restart script could restart the PBS daemon #
  8 +# since it's called after all the configuration is done (ipandhost scripts) #
  9 +# ************************************************************************* #
  10 +
  11 +RELDIR=`dirname $0`
  12 +ABSDIR=`cd $RELDIR; pwd`
  13 +echo "Hello from \"$ABSDIR/$0\""
  14 +
  15 +echo ""
  16 +echo "This node was told it required testrole2, so this "testrole2" restarts"
  17 +echo "script triggers booting up something or other in response to this fact."
  18 +
  19 +# See real examples for when you'd want to make a restarts script.
  20 +
  21 +
20 ctx-agent/ctx-scripts/4-restarts/torquemaster
... ... @@ -0,0 +1,20 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 4-restarts scripts are a little counter-intuitive. If *requiring a role* #
  5 +# implies this node *plays a role*, you can base restarts off of this. #
  6 +# For example, if "pbsslave" is a required role, it implies this node is a #
  7 +# PBS server and the pbsslave restart script could restart the PBS daemon #
  8 +# since it's called after all the configuration is done (ipandhost scripts) #
  9 +# ************************************************************************* #
  10 +
  11 +RELDIR=`dirname $0`
  12 +ABSDIR=`cd $RELDIR; pwd`
  13 +echo "Hello from \"$ABSDIR/$0\""
  14 +
  15 +echo "Torque server role needed, restart Torque client"
  16 +
  17 +/etc/init.d/pbs_mom start
  18 +
  19 +exit 0
  20 +
21 ctx-agent/ctx-scripts/4-restarts/torqueslave
... ... @@ -0,0 +1,21 @@
  1 +#!/bin/sh
  2 +
  3 +# ************************************************************************* #
  4 +# 4-restarts scripts are a little counter-intuitive. If *requiring a role* #
  5 +# implies this node *plays a role*, you can base restarts off of this. #
  6 +# For example, if "pbsslave" is a required role, it implies this node is a #
  7 +# PBS server and the pbsslave restart script could restart the PBS daemon #
  8 +# since it's called after all the configuration is done (ipandhost scripts) #
  9 +# ************************************************************************* #
  10 +
  11 +RELDIR=`dirname $0`
  12 +ABSDIR=`cd $RELDIR; pwd`
  13 +echo "Hello from \"$ABSDIR/$0\""
  14 +
  15 +echo "Torque client role needed, restart Torque server"
  16 +
  17 +/etc/init.d/pbs_sched start
  18 +/etc/init.d/pbs_server start
  19 +
  20 +exit 0
  21 +
94 ctx-agent/ctx-scripts/5-thishost-finalize/publicnic
... ... @@ -0,0 +1,94 @@
  1 +#!/bin/sh
  2 +
  3 +# ********************************************************************* #
  4 +# 5-thishost-finalize scripts are called with *this* node's IP, short #
  5 +# hostname and fully qualified hostname. They are called *after* #
  6 +# 4-restarts (as the numbering system implies). They are somewhat #
  7 +# esoteric, but can be useful if a local program depends on one of the #
  8 +# things restarted in 4-restarts. #
  9 +# ********************************************************************* #
  10 +
  11 +RELDIR=`dirname $0`
  12 +ABSDIR=`cd $RELDIR; pwd`
  13 +echo "Hello from \"$ABSDIR/$0\""
  14 +
  15 +# NOTE: The name of this script must correspond to the interface name that
  16 +# the context broker knows, not the local interface name which may or
  17 +# may not match.
  18 +#
  19 +# The context agent can only handle two NICs at most. By convention, if
  20 +# there is more than one NIC, the nics need to be labelled "publicnic" or
  21 +# "localnic" as defined by the metadata server. On EC2, the publicnic
  22 +# is the public IP address that NATs the VM (it does not correspond to
  23 +# an actual NIC in the VM). Note again that the labelling is NOT the
  24 +# interface name in the VM but rather the labels in the contextualization
  25 +# document where different roles may be played by different IP addresses
  26 +# (and they are labelled with NIC names).
  27 +
  28 +echo "publicnic thishost finalize: configuring or launching something after restarts"
  29 +
  30 +echo "This IP: $1"
  31 +echo "This short local hostname: $2"
  32 +echo "This FQDN: $3"
  33 +
  34 +# We're overloading torque master role to imply other head node setups.
  35 +# Could do something explicit by way of the context roles too, but this
  36 +# works just fine (assuming torque master is always same node as GT).
  37 +if [ ! -e "/root/this_node_is_torque_master" ]; then
  38 + exit 0
  39 +fi
  40 +
  41 +
  42 +# cluster-001:
  43 +
  44 +# Start postgresql before Globus
  45 +/etc/init.d/postgresql start
  46 +if [ $? -ne 0 ]; then
  47 + echo "problem starting postgresql"
  48 + exit 1
  49 +fi
  50 +
  51 +# We have put a keyword everywhere that the local hostname needs to appear
  52 +# in the GT4 configs. This sed command replaces keyword with local FQDN.
  53 +
  54 +REPLACEKEYWORD="THISHOST_REPLACE_FQDN"
  55 +GL="/opt/gt4"
  56 +
  57 +function replace (){
  58 + echo "Adding local FQDN to: $2"
  59 +
  60 + OUTPUTFILE=/root/safe/`uuidgen`
  61 +
  62 + sed "s/$REPLACEKEYWORD/$1/g" $2 > $OUTPUTFILE
  63 +
  64 + # Trick while you're setting contextualization up: manually call this
  65 + # script and run the sed replacement backwards,to get back to the replacement
  66 + # tokens before the image is --save'd back to the repository.
  67 + # sed "s/$1/$REPLACEKEYWORD/g" $2 > $OUTPUTFILE
  68 +
  69 + cp $OUTPUTFILE $2
  70 +}
  71 +
  72 +replace $3 $GL/etc/gram-service/jndi-config.xml
  73 +replace $3 $GL/etc/gram-service/globus_gram_fs_map_config.xml
  74 +replace $3 $GL/etc/globus-job-manager.conf
  75 +replace $3 $GL/etc/globus_wsrf_core/server-config.wsdd
  76 +replace $3 $GL/client-config.wsdd
  77 +
  78 +
  79 +# see 3-data/startcontainer
  80 +if [ ! -e "/root/do_startcontainer" ]; then
  81 + exit 0
  82 +fi
  83 +
  84 +# Start GT container.
  85 +/etc/init.d/globus start
  86 +if [ $? -ne 0 ]; then
  87 + echo "problem starting globus container"
  88 + exit 1
  89 +fi
  90 +
  91 +
  92 +
  93 +
  94 +
21 ctx-agent/ctx-scripts/clean.sh
... ... @@ -0,0 +1,21 @@
  1 +#!/bin/sh
  2 +
  3 +# You can put commands that 'reset' the VM for contextualization
  4 +# here and then call this before launch.sh in your rc.local (like
  5 +# the sample clusters do).
  6 +
  7 +cp /etc/hosts.clean /etc/hosts
  8 +cp /etc/exports.clean /etc/exports
  9 +
  10 +cat /dev/null > /etc/hosts.equiv
  11 +
  12 +# wipe the torque nodes file, ipandhost script will fill it with all
  13 +# compute nodes
  14 +cat /dev/null > /var/spool/torque/server_priv/nodes
  15 +
  16 +rm -f /root/this_node_is_torque_master
  17 +
  18 +cat /dev/null > /opt/nimbus/ctxlog.txt
  19 +rm -rf /opt/nimbus/ctx/tmp/
  20 +mkdir /opt/nimbus/ctx/tmp/
  21 +
9 ctx-agent/ctx-scripts/problem.sh
... ... @@ -0,0 +1,9 @@
  1 +#!/bin/sh
  2 +
  3 +echo "Problem script running... shutting down."
  4 +touch /tmp/contextualization_problem_script_ran
  5 +
  6 +echo "Poweroff could be run here. Currently commented out."
  7 +# /sbin/poweroff
  8 +
  9 +
178 ctx-agent/ctx/ctx.conf
... ... @@ -0,0 +1,178 @@
  1 +[sshd]
  2 +
  3 +# Absolute path only, the sshd host key
  4 +generatedkey: /etc/ssh/ssh_host_rsa_key.pub
  5 +
  6 +# SSHd hosts config is adjusted directly by this program right now, adds
  7 +# equiv hostnames and pubkeys for host based authorization across the whole
  8 +# contextualization context.
  9 +
  10 +hostbasedconfig: /etc/hosts.equiv
  11 +knownhostsconfig: /etc/ssh/ssh_known_hosts
  12 +
  13 +
  14 +[reginst]
  15 +
  16 +#### Regular instantiation
  17 +
  18 +# Path to metadata server URL file
  19 +path: /var/nimbus-metadata-server-url
  20 +
  21 +# Comma separated names of possible identity nics (do NOT use lo, for example).
  22 +# These are REAL local interface names that may be present (each is checked for
  23 +# an IP configuration).
  24 +nicnames: eth0, eth1
  25 +
  26 +
  27 +[systempaths]
  28 +
  29 +# These can be relative or absolute paths.
  30 +hostname: hostname
  31 +curl: curl
  32 +
  33 +
  34 +# ***NOTE: it is unlikely you need to alter the configurations below this line
  35 +
  36 +[taskpaths]
  37 +
  38 +#### Calling order (this is explained in more detail below).
  39 +#### 0-etchosts
  40 +#### 1-ipandhost
  41 +#### 2-thishost
  42 +#### 3-data
  43 +#### 4-restarts
  44 +#### 5-thishostfinalize
  45 +
  46 +
  47 +#### 0-etchosts
  48 +#
  49 +# every identity seen is always sent to etchosts
  50 +# arg1: IP
  51 +# arg2: short hostname
  52 +# arg3: FQDN
  53 +
  54 +etchosts: /opt/nimbus/ctx-scripts/0-etchosts.sh
  55 +
  56 +
  57 +#### 1-ipandhost
  58 +#
  59 +# Directory where the scripts live that match the required role names.
  60 +# See samples for more explanation.
  61 +#
  62 +# These role scripts receive:
  63 +# arg1: IP
  64 +# arg2: short hostname
  65 +# arg3: FQDN
  66 +
  67 +ipandhostdir: /opt/nimbus/ctx-scripts/1-ipandhost
  68 +
  69 +
  70 +#### 2-thishost
  71 +#
  72 +# "thishost" scripts are called with network information known about the
  73 +# host this program is running on.
  74 +#
  75 +# Each script receives:
  76 +# arg1: IP
  77 +# arg2: Short local hostname
  78 +# arg3: FQDN
  79 +#
  80 +# The names of the scripts in this directory must correspond to the interface
  81 +# that the context broker knows about, not the local interface which may not
  82 +# match.
  83 +#
  84 +# Particular scripts may be absent. The entire directory configuration
  85 +# may also be absent.
  86 +
  87 +thishostdir: /opt/nimbus/ctx-scripts/2-thishost
  88 +
  89 +
  90 +#### 3-data
  91 +#
  92 +# The opaque data directory contains scripts that match provided data names.
  93 +# If data fields exist in the context, the data is written to a file and
  94 +# that file absolute path is sent as only argument to the scripts.
  95 +# The scripts are called after 'thishost' but before 'restarts'.
  96 +
  97 +datadir: /opt/nimbus/ctx-scripts/3-data
  98 +
  99 +
  100 +#### 4-restarts
  101 +#
  102 +# The restart directory contains scripts that match provided roles.
  103 +#
  104 +# After all role information has been added via the ipandhostdir script AND
  105 +# after the "thishost" scripts have successfully run, this program will call
  106 +# the restart script for each required role it knows about (presumably to
  107 +# restart the service now that config has changed).
  108 +#
  109 +# No arguments are sent.
  110 +#
  111 +# It is OK for the required role to not have a script in this directory.
  112 +
  113 +restartdir: /opt/nimbus/ctx-scripts/4-restarts
  114 +
  115 +
  116 +#### 5-thishostfinalize
  117 +#
  118 +# The "thishostfinalize" scripts are called with network information known
  119 +# about the host this program is running on. It is called AFTER the restart
  120 +# scripts are successfully called.
  121 +#
  122 +# Each script receives:
  123 +# arg1: IP
  124 +# arg2: Short local hostname
  125 +# arg3: FQDN
  126 +#
  127 +# The names of the scripts in this directory must correspond to the interface
  128 +# that the context broker knows about, not the local interface which may not
  129 +# match.
  130 +#
  131 +# Particular scripts may be absent. The entire directory configuration
  132 +# may also be absent.
  133 +
  134 +thishostfinalizedir: /opt/nimbus/ctx-scripts/5-thishost-finalize
  135 +
  136 +
  137 +# "problem" script
  138 +# In case of problems, could call poweroff. This script will be called after
  139 +# an attempt to notify the service of the error (that notification provides
  140 +# a log of the run to the context broker).
  141 +#
  142 +# Must be configured if "--poweroff" (-p) argument is used, will not be
  143 +# consulted if that argument is not used.
  144 +
  145 +problemscript: /opt/nimbus/ctx-scripts/problem.sh
  146 +
  147 +
  148 +[ctxservice]
  149 +
  150 +# logfile of the run
  151 +# If config is missing, no log will be written and nothing will be sent to
  152 +# service for error reporting.
  153 +logfilepath: /opt/nimbus/ctxlog.txt
  154 +
  155 +# Directory where the program can write temporary files
  156 +scratchspacedir: /opt/nimbus/ctx/tmp
  157 +
  158 +retr_template: /opt/nimbus/ctx/lib/retr-template-001.xml
  159 +retr_template2: /opt/nimbus/ctx/lib/retr-template-002.xml
  160 +err_template: /opt/nimbus/ctx/lib/err-template-001.xml
  161 +err_template2: /opt/nimbus/ctx/lib/err-template-002.xml
  162 +ok_template: /opt/nimbus/ctx/lib/ok-template-001.xml
  163 +ok_template2: /opt/nimbus/ctx/lib/ok-template-002.xml
  164 +
  165 +
  166 +
  167 +[ec2]
  168 +
  169 +#### EC2 instantiation (alternative to regular method)
  170 +
  171 +# URLs for the Amazon REST instance data API
  172 +localhostnameURL: http://169.254.169.254/2007-01-19/meta-data/local-hostname
  173 +publichostnameURL: http://169.254.169.254/2007-01-19/meta-data/public-hostname
  174 +localipURL: http://169.254.169.254/2007-01-19/meta-data/local-ipv4
  175 +publicipURL: http://169.254.169.254/2007-01-19/meta-data/public-ipv4
  176 +publickeysURL: http://169.254.169.254/2007-01-19/meta-data/public-keys/
  177 +userdataURL: http://169.254.169.254/2007-01-19/user-data
  178 +
10 ctx-agent/ctx/launch.sh
... ... @@ -0,0 +1,10 @@
  1 +#!/bin/sh
  2 +
  3 +BASEDIR=`dirname $0`
  4 +
  5 +PYTHONPATH="$BASEDIR/lib/pylib:$PYTHONPATH"
  6 +export PYTHONPATH
  7 +
  8 +python $BASEDIR/lib/workspace_ctx_retrieve.py -c $BASEDIR/ctx.conf -z -t
  9 +
  10 +
37 ctx-agent/ctx/lib/err-template-001.xml
... ... @@ -0,0 +1,37 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  3 +xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  4 +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 +xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
  6 + <soapenv:Header>
  7 + <wsa:MessageID soapenv:mustUnderstand="0">uuid:REPLACE_MESSAGE_ID</wsa:MessageID>
  8 + <wsa:To soapenv:mustUnderstand="0">REPLACE_SERVICE_URL</wsa:To>
  9 + <wsa:Action soapenv:mustUnderstand="0">
  10 + http://www.globus.org/2008/12/nimbus/contextualization/NimbusContextBrokerPortType/retrieveRequest</wsa:Action>
  11 + <wsa:From soapenv:mustUnderstand="0">
  12 + <wsa:Address>
  13 + http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
  14 + </wsa:From>
  15 + <ns2:NimbusContextBrokerKey xmlns:ns2="http://www.globus.org/2008/12/nimbus/contextualization"
  16 + soapenv:mustUnderstand="0">REPLACE_RESOURCE_KEY</ns2:NimbusContextBrokerKey>
  17 + </soapenv:Header>
  18 + <soapenv:Body>
  19 + <errorExiting xmlns="http://www.globus.org/2008/12/nimbus/contextualization">
  20 +
  21 + <ns2:identity xmlns:ns2="http://www.globus.org/2008/12/nimbus/ctxdescription">
  22 +
  23 + <ns2:interface>REPLACE_IFACE_NAME</ns2:interface>
  24 + <ns2:ip>REPLACE_IFACE_IP</ns2:ip>
  25 + <ns2:hostname>REPLACE_IFACE_HOSTNAME</ns2:hostname>
  26 + <ns2:pubkey>REPLACE_IFACE_SSH_KEY</ns2:pubkey>
  27 + </ns2:identity>
  28 +
  29 + <ns11:errorcode xmlns:ns11="http://www.globus.org/2008/12/nimbus/ctxtypes">REPLACE_ERRORCODE</ns11:errorcode>
  30 + <ns12:message xmlns:ns12="http://www.globus.org/2008/12/nimbus/ctxtypes">
  31 + <![CDATA[REPLACE_ERRORMSG]]>
  32 + </ns12:message>
  33 +
  34 + </errorExiting>
  35 + </soapenv:Body>
  36 +</soapenv:Envelope>
  37 +
45 ctx-agent/ctx/lib/err-template-002.xml
... ... @@ -0,0 +1,45 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  3 +xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  4 +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 +xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
  6 + <soapenv:Header>
  7 + <wsa:MessageID soapenv:mustUnderstand="0">uuid:REPLACE_MESSAGE_ID</wsa:MessageID>
  8 + <wsa:To soapenv:mustUnderstand="0">REPLACE_SERVICE_URL</wsa:To>
  9 + <wsa:Action soapenv:mustUnderstand="0">
  10 + http://www.globus.org/2008/12/nimbus/contextualization/NimbusContextBrokerPortType/retrieveRequest</wsa:Action>
  11 + <wsa:From soapenv:mustUnderstand="0">
  12 + <wsa:Address>
  13 + http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
  14 + </wsa:From>
  15 + <ns2:NimbusContextBrokerKey xmlns:ns2="http://www.globus.org/2008/12/nimbus/contextualization"
  16 + soapenv:mustUnderstand="0">REPLACE_RESOURCE_KEY</ns2:NimbusContextBrokerKey>
  17 + </soapenv:Header>
  18 + <soapenv:Body>
  19 + <errorExiting xmlns="http://www.globus.org/2008/12/nimbus/contextualization">
  20 +
  21 + <ns1:identity xmlns:ns1="http://www.globus.org/2008/12/nimbus/ctxdescription">
  22 +
  23 + <ns1:interface>REPLACE_IFACE_NAME</ns1:interface>
  24 + <ns1:ip>REPLACE_IFACE_IP</ns1:ip>
  25 + <ns1:hostname>REPLACE_IFACE_HOSTNAME</ns1:hostname>
  26 + <ns1:pubkey>REPLACE_IFACE_SSH_KEY</ns1:pubkey>
  27 + </ns1:identity>
  28 +
  29 + <ns2:identity xmlns:ns2="http://www.globus.org/2008/12/nimbus/ctxdescription">
  30 +
  31 + <ns2:interface>REPLACE_IFACE2_NAME</ns2:interface>
  32 + <ns2:ip>REPLACE_IFACE2_IP</ns2:ip>
  33 + <ns2:hostname>REPLACE_IFACE2_HOSTNAME</ns2:hostname>
  34 + <ns2:pubkey>REPLACE_IFACE2_SSH_KEY</ns2:pubkey>
  35 + </ns2:identity>
  36 +
  37 + <ns11:errorcode xmlns:ns11="http://www.globus.org/2008/12/nimbus/ctxtypes">REPLACE_ERRORCODE</ns11:errorcode>
  38 + <ns12:message xmlns:ns12="http://www.globus.org/2008/12/nimbus/ctxtypes">
  39 + <![CDATA[REPLACE_ERRORMSG]]>
  40 + </ns12:message>
  41 +
  42 + </errorExiting>
  43 + </soapenv:Body>
  44 +</soapenv:Envelope>
  45 +
40 ctx-agent/ctx/lib/ok-template-001.xml
... ... @@ -0,0 +1,40 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  3 +xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  4 +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 +xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
  6 + <soapenv:Header>
  7 + <wsa:MessageID soapenv:mustUnderstand="0">uuid:REPLACE_MESSAGE_ID</wsa:MessageID>
  8 + <wsa:To soapenv:mustUnderstand="0">REPLACE_SERVICE_URL</wsa:To>
  9 + <wsa:Action soapenv:mustUnderstand="0">
  10 + http://www.globus.org/2008/12/nimbus/contextualization/NimbusContextBrokerPortType/retrieveRequest</wsa:Action>
  11 + <wsa:From soapenv:mustUnderstand="0">
  12 + <wsa:Address>
  13 + http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
  14 + </wsa:From>
  15 + <ns2:NimbusContextBrokerKey xmlns:ns2="http://www.globus.org/2008/12/nimbus/contextualization"
  16 + soapenv:mustUnderstand="0">REPLACE_RESOURCE_KEY</ns2:NimbusContextBrokerKey>
  17 + </soapenv:Header>
  18 + <soapenv:Body>
  19 + <okExiting xmlns="http://www.globus.org/2008/12/nimbus/contextualization">
  20 +
  21 + <ns1:identity xmlns:ns1="http://www.globus.org/2008/12/nimbus/ctxdescription">
  22 +
  23 + <ns1:interface>REPLACE_IFACE_NAME</ns1:interface>
  24 + <ns1:ip>REPLACE_IFACE_IP</ns1:ip>
  25 + <ns1:hostname>REPLACE_IFACE_HOSTNAME</ns1:hostname>
  26 + <ns1:pubkey>REPLACE_IFACE_SSH_KEY</ns1:pubkey>
  27 + </ns1:identity>
  28 +
  29 + <ns2:identity xmlns:ns2="http://www.globus.org/2008/12/nimbus/ctxdescription">
  30 +
  31 + <ns2:interface>REPLACE_IFACE2_NAME</ns2:interface>
  32 + <ns2:ip>REPLACE_IFACE2_IP</ns2:ip>
  33 + <ns2:hostname>REPLACE_IFACE2_HOSTNAME</ns2:hostname>
  34 + <ns2:pubkey>REPLACE_IFACE2_SSH_KEY</ns2:pubkey>
  35 + </ns2:identity>
  36 +
  37 + </okExiting>
  38 + </soapenv:Body>
  39 +</soapenv:Envelope>
  40 +
40 ctx-agent/ctx/lib/ok-template-002.xml
... ... @@ -0,0 +1,40 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  3 +xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  4 +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 +xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
  6 + <soapenv:Header>
  7 + <wsa:MessageID soapenv:mustUnderstand="0">uuid:REPLACE_MESSAGE_ID</wsa:MessageID>
  8 + <wsa:To soapenv:mustUnderstand="0">REPLACE_SERVICE_URL</wsa:To>
  9 + <wsa:Action soapenv:mustUnderstand="0">
  10 + http://www.globus.org/2008/12/nimbus/contextualization/NimbusContextBrokerPortType/retrieveRequest</wsa:Action>
  11 + <wsa:From soapenv:mustUnderstand="0">
  12 + <wsa:Address>
  13 + http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
  14 + </wsa:From>
  15 + <ns2:NimbusContextBrokerKey xmlns:ns2="http://www.globus.org/2008/12/nimbus/contextualization"
  16 + soapenv:mustUnderstand="0">REPLACE_RESOURCE_KEY</ns2:NimbusContextBrokerKey>
  17 + </soapenv:Header>
  18 + <soapenv:Body>
  19 + <okExiting xmlns="http://www.globus.org/2008/12/nimbus/contextualization">
  20 +
  21 + <ns1:identity xmlns:ns1="http://www.globus.org/2008/12/nimbus/ctxdescription">
  22 +
  23 + <ns1:interface>REPLACE_IFACE_NAME</ns1:interface>
  24 + <ns1:ip>REPLACE_IFACE_IP</ns1:ip>
  25 + <ns1:hostname>REPLACE_IFACE_HOSTNAME</ns1:hostname>
  26 + <ns1:pubkey>REPLACE_IFACE_SSH_KEY</ns1:pubkey>
  27 + </ns1:identity>
  28 +
  29 + <ns2:identity xmlns:ns2="http://www.globus.org/2008/12/nimbus/ctxdescription">
  30 +
  31 + <ns2:interface>REPLACE_IFACE2_NAME</ns2:interface>
  32 + <ns2:ip>REPLACE_IFACE2_IP</ns2:ip>
  33 + <ns2:hostname>REPLACE_IFACE2_HOSTNAME</ns2:hostname>
  34 + <ns2:pubkey>REPLACE_IFACE2_SSH_KEY</ns2:pubkey>
  35 + </ns2:identity>
  36 +
  37 + </okExiting>
  38 + </soapenv:Body>
  39 +</soapenv:Envelope>
  40 +
141 ctx-agent/ctx/lib/pylib/embeddedET/ElementInclude.py
... ... @@ -0,0 +1,141 @@
  1 +#
  2 +# ElementTree
  3 +# $Id: ElementInclude.py,v 1.1.1.1 2008/11/11 20:27:50 tfreeman Exp $
  4 +#
  5 +# limited xinclude support for element trees
  6 +#
  7 +# history:
  8 +# 2003-08-15 fl created
  9 +# 2003-11-14 fl fixed default loader
  10 +#
  11 +# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved.
  12 +#
  13 +# fredrik@pythonware.com
  14 +# http://www.pythonware.com
  15 +#
  16 +# --------------------------------------------------------------------
  17 +# The ElementTree toolkit is
  18 +#
  19 +# Copyright (c) 1999-2004 by Fredrik Lundh
  20 +#
  21 +# By obtaining, using, and/or copying this software and/or its
  22 +# associated documentation, you agree that you have read, understood,
  23 +# and will comply with the following terms and conditions:
  24 +#
  25 +# Permission to use, copy, modify, and distribute this software and
  26 +# its associated documentation for any purpose and without fee is
  27 +# hereby granted, provided that the above copyright notice appears in
  28 +# all copies, and that both that copyright notice and this permission
  29 +# notice appear in supporting documentation, and that the name of
  30 +# Secret Labs AB or the author not be used in advertising or publicity
  31 +# pertaining to distribution of the software without specific, written
  32 +# prior permission.
  33 +#
  34 +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  35 +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
  36 +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
  37 +# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
  38 +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  39 +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  40 +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  41 +# OF THIS SOFTWARE.
  42 +# --------------------------------------------------------------------
  43 +
  44 +##
  45 +# Limited XInclude support for the ElementTree package.
  46 +##
  47 +
  48 +import copy
  49 +import ElementTree