diff --git a/src/network.py b/src/network.py index 5e6250a..0bf902a 100755 --- a/src/network.py +++ b/src/network.py @@ -544,6 +544,10 @@ class NetworkMgr(object): def has_user(self, username): [status, _value] = self.etcd.getkey("network/users/"+username) + self.load_usrgw(username) + if username not in self.usrgws.keys(): + self.usrgws[username] = self.masterip + self.dump_usrgw(username) return status def acquire_userips(self, username, num=1): diff --git a/tools/update_baseurl.sh b/tools/update_baseurl.sh new file mode 100755 index 0000000..4f5c4a1 --- /dev/null +++ b/tools/update_baseurl.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +toolsdir=${0%/*} +DOCKLET_TOOLS=$(cd $toolsdir; pwd) +DOCKLET_HOME=${DOCKLET_TOOLS%/*} +DOCKLET_CONF=$DOCKLET_HOME/conf + +. $DOCKLET_CONF/docklet.conf + +masterip=$(ifconfig ${NETWORK_DEVICE} | awk '/inet/ {print $2}' | awk -F: '{print $2}' | head -1) +cons=$(ls /var/lib/lxc) + +echo ${masterip} +for i in ${cons} +do + sed -i "s/BASE_URL=\/go/BASE_URL=\/${masterip}\/go/g" /var/lib/lxc/${i}/rootfs/home/jupyter/jupyter.config + running=$(lxc-info -n ${i} | grep RUNNING) + if [ "${running}" != '' ] + then + echo "Stop ${i}..." + lxc-stop -k -n ${i} + echo "Start ${i}..." + lxc-start -n ${i} + lxc-attach -n ${i} -- su -c /home/jupyter/start_jupyter.sh + lxc-attach -n ${i} -- service ssh start + fi +done