From 757bd0b5e4dd7a533a9d39c9f68dffc7faa61dda Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Fri, 28 Jan 2011 15:58:58 -0800 Subject: [PATCH] bug 8254: point save password to right location --- .../systemvm/debian/config/root/savepassword.sh | 17 +++++------------ scripts/network/domr/save_password_to_domr.sh | 6 ++++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/patches/systemvm/debian/config/root/savepassword.sh b/patches/systemvm/debian/config/root/savepassword.sh index e756acb0c54..93cad3d74f3 100755 --- a/patches/systemvm/debian/config/root/savepassword.sh +++ b/patches/systemvm/debian/config/root/savepassword.sh @@ -2,6 +2,7 @@ # Usage # save_password -v -p # +PASSWD_FILE=/var/cache/cloud/passwords while getopts 'v:p:' OPTION do @@ -18,17 +19,9 @@ do esac done -if [ ! -f /root/passwords ]; - then - touch /root/passwords; -fi +[ -f $PASSWD_FILE ] || touch $PASSWD_FILE -sed -i /$VM_IP/d /root/passwords -echo "$VM_IP=$PASSWORD" >> /root/passwords +sed -i /$VM_IP/d $PASSWD_FILE +echo "$VM_IP=$PASSWORD" >> $PASSWD_FILE -if [ $? -ne 0 ] -then - exit 1 -fi - -exit 0 +exit $? diff --git a/scripts/network/domr/save_password_to_domr.sh b/scripts/network/domr/save_password_to_domr.sh index 56f1becde8c..304a760f56f 100755 --- a/scripts/network/domr/save_password_to_domr.sh +++ b/scripts/network/domr/save_password_to_domr.sh @@ -2,6 +2,8 @@ # $Id: save_password_to_domr.sh 9804 2010-06-22 18:36:49Z alex $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/network/domr/save_password_to_domr.sh $ # @VERSION@ +PASSWD_FILE=/var/cache/cloud/passwords + #replace a line in a file of the form key=value # $1 filename # $2 keyname @@ -42,9 +44,9 @@ done VIA_SSH="ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$DOMR_IP" -$VIA_SSH "if [ ! -f /root/passwords ]; then touch /root/passwords; fi;" +$VIA_SSH "if [ ! -f $PASSWD_FILE ]; then touch $PASSWD_FILE; fi;" -replace_in_file_on_domr /root/passwords $VM_IP $PASSWORD +replace_in_file_on_domr $PASSWD_FILE $VM_IP $PASSWORD if [ $? -ne 0 ] then