Merge pull request #237 from FirmlyReality/master
1.check usrgw when call has_user. 2.update base_url in container
This commit is contained in:
commit
e84a7e35aa
|
@ -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):
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue