summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-10-16 02:21:33 +0200
committerChristian Pointner <equinox@spreadspace.org>2012-10-16 02:21:33 +0200
commit70fdcf95d1ff3c002f496516ab59e4c23d655262 (patch)
tree698a281f64dbdf099e21d31efabbdfef7448e045
parentupdated TODO (diff)
flufigut clean works now
-rwxr-xr-xsrc/flufigut-client.sh36
-rwxr-xr-xsrc/manage.sh22
-rw-r--r--src/ssh.config8
-rwxr-xr-xsrc/update.sh1
4 files changed, 58 insertions, 9 deletions
diff --git a/src/flufigut-client.sh b/src/flufigut-client.sh
index aad3a06..e62a465 100755
--- a/src/flufigut-client.sh
+++ b/src/flufigut-client.sh
@@ -56,25 +56,34 @@ if [ "install" = "$1" ]; then
echo 'command="/usr/local/bin/flufigut-client.sh",no-X11-forwarding,no-agent-forwarding,no-port-forwarding '$pubkey > /var/lib/flufigut/.ssh/authorized_keys
chown -R flufigut:flufigut /var/lib/flufigut/.ssh
chmod 600 /var/lib/flufigut/.ssh/authorized_keys
- echo "flufigut ALL = (flumotion) NOPASSWD: $DAEMON, /bin/tar" >> /etc/sudoers
+ echo "flufigut ALL = (flumotion) NOPASSWD: $DAEMON, /bin/tar, /bin/rm" >> /etc/sudoers
fi
echo "successfully installed flufigut client."
exit 0
fi
+remove_instance() {
+ type="$1"
+ name="$2"
+ if [ "$1" = "worker" ]; then
+ sudo -u flumotion rm "$CONF_DIR/workers/$2.xml"
+ elif [ "$1" = "manager" ]; then
+ sudo -u flumotion rm -rf "$CONF_DIR/managers/$2/"
+ sudo -u flumotion rm "$CONF_DIR/$2.passwd"
+ else
+ echo "WARN: ignorng unknown type $1"
+ fi
+}
+
start_instance() {
- type="$1"
- name="$2"
- sudo -u flumotion $DAEMON $DAEMON_ARGS start $type $name
- return "$?"
+ sudo -u flumotion $DAEMON $DAEMON_ARGS start "$1" "$2"
+ return "$?"
}
stop_instance() {
- type="$1"
- name="$2"
- sudo -u flumotion $DAEMON $DAEMON_ARGS stop $type $name
- return "$?"
+ sudo -u flumotion $DAEMON $DAEMON_ARGS stop "$1" "$2"
+ return "$?"
}
command=`echo $SSH_ORIGINAL_COMMAND | awk '{ print $1 }'`
@@ -88,6 +97,15 @@ case "$command" in
rm "$param"
echo "done."
;;
+ remove)
+ echo -n "removing files ... "
+ while read line; do
+ type=`echo $line | awk '{ print $1 }'`
+ name=`echo $line | awk '{ print $2 }'`
+ remove_instance $type $name
+ done
+ echo "ok."
+ ;;
start)
echo -n "starting ... "
while read line; do
diff --git a/src/manage.sh b/src/manage.sh
index 3ac0303..92596af 100755
--- a/src/manage.sh
+++ b/src/manage.sh
@@ -54,6 +54,17 @@ deploy_all() {
done
}
+clean_all() {
+ for machine in "$OUTPUT_DIR"/*; do
+ if [ -d "$machine" ]; then
+ machine=`basename $machine`
+ echo "removing files from $machine ... "
+ generate_instance_list $machine
+ ssh -i "$SSH_KEY" -F "$SSH_CONFIG" $SSH_USER@"$machine" remove < "$OUTPUT_DIR/$machine.list"
+ fi
+ done
+}
+
generate_instance_list() {
machine=$1
@@ -117,6 +128,17 @@ case "$1" in
echo "Deploying configuration to all machines ..."
deploy_all
;;
+ clean)
+ echo "cleaning/removing configuration from all machines ..."
+ clean_all
+ ;;
+ wipe)
+ if [ -z "$2" ]; then
+ echo "Usage: $0 wipe <planet name>"
+ fi
+ echo "wipeing configuration for from all machines inside ssh-config ..."
+ wipe_all
+ ;;
start)
echo "Start manager and worker on all machines ..."
start_all
diff --git a/src/ssh.config b/src/ssh.config
index 7744443..2d6c033 100644
--- a/src/ssh.config
+++ b/src/ssh.config
@@ -9,3 +9,11 @@ Host telesto
Host calypso
HostName 89.106.215.48
Port 22000
+
+Host supermicro
+ HostName 89.106.215.45
+ Port 22000
+
+Host elevate1
+ HostName 5.9.104.71
+ Port 22000
diff --git a/src/update.sh b/src/update.sh
index ca4f028..b28347a 100755
--- a/src/update.sh
+++ b/src/update.sh
@@ -36,6 +36,7 @@ fi
TEMPLATES="example"
./manage.sh stop
+./manage.sh clean
./flufigut.py "$TEMPLATES" $1
./manage.sh deploy
./manage.sh start