Commit 8a8fa109 authored by David Johnson's avatar David Johnson

Use a less lame swapper == geniuser check.

If you instantiate a portal expt on Emulab (where you might have a real
account), the swapper is you, not geniuser.  So, check geniuser via
geni-get slice_urn success/failure.
parent 1dc78db1
......@@ -142,7 +142,7 @@ if [ ${DEFAULT_SECGROUP_ENABLE_SSH_ICMP} -eq 1 ]; then
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
fi
if [ "$SWAPPER" = "geniuser" ] ; then
if [ $GENIUSER -eq 1 ] ; then
echo "*** Importing GENI user keys for admin user..."
$DIRNAME/setup-user-info.py
......
......@@ -85,13 +85,35 @@ NEWNODELIST=""
# We might store any missing nodes here
OLDNODELIST=""
##
## Detect if this was a geni experiment
##
grep GENIUSER $SETTINGS
if [ ! $? -eq 0 ]; then
geni-get slice_urn >/dev/null 2>&1
if [ $? -eq 0 ]; then
GENIUSER=1
echo "GENIUSER=1" >> $SETTINGS
else
GENIUSER=0
echo "GENIUSER=0" >> $SETTINGS
fi
else
grep GENIUSER=1 $SETTINGS
if [ $? -eq 0 ]; then
GENIUSER=1
else
GENIUSER=0
fi
fi
##
## Grab our geni creds, and create a GENI credential cert
##
#
# NB: force the install of python-m2crypto if geniuser
#
if [ "$SWAPPER" = "geniuser" ]; then
if [ $GENIUSER -eq 1 ]; then
dpkg -s python-m2crypto >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
apt-get install python-m2crypto
......@@ -152,7 +174,7 @@ fi
#
if [ ! -e $OURDIR/parameters ]; then
touch $OURDIR/parameters
if [ "$SWAPPER" = "geniuser" ]; then
if [ $GENIUSER -eq 1 ]; then
cat $OURDIR/manifests.0.xml | sed -n -e 's/^[^<]*<[^:]*:parameter>\([^<]*\)<\/[^:]*:parameter>/\1/p' > $OURDIR/parameters
fi
fi
......@@ -209,13 +231,13 @@ else
OSCODENAME="juno"
fi
if [ "$SWAPPER" = "geniuser" ]; then
if [ $GENIUSER -eq 1 ]; then
SWAPPER_EMAIL=`geni-get slice_email`
else
SWAPPER_EMAIL="$SWAPPER@$OURDOMAIN"
fi
if [ "$SWAPPER" = "geniuser" ]; then
if [ $GENIUSER -eq 1 ]; then
PUBLICADDRS=`cat $OURDIR/manifests.0.xml | perl -e 'while (<STDIN>) { while ($_ =~ m/\<emulab:ipv4 address="([\d.]+)\" netmask=\"([\d\.]+)\"/g) { print "$1\n"; } }' | xargs`
PUBLICCOUNT=0
for ip in $PUBLICADDRS ; do
......
......@@ -47,7 +47,11 @@ if [ ! -f /root/.ssh/${KEYNAME} ]; then
ssh-keygen -t rsa -f /root/.ssh/${KEYNAME} -N ''
fi
if [ "$SWAPPER" = "geniuser" ]; then
if [ -f $SETTINGS ]; then
. $SETTINGS
fi
if [ $GENIUSER -eq 1 ]; then
SHAREDIR=/proj/$EPID/exp/$EEID/tmp
cp /root/.ssh/${KEYNAME}.pub $SHAREDIR/$HOSTNAME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment