bug 8254: point save password to right location

This commit is contained in:
Chiradeep Vittal 2011-01-28 15:58:58 -08:00
parent 80640f9d01
commit 757bd0b5e4
2 changed files with 9 additions and 14 deletions

View File

@ -2,6 +2,7 @@
# Usage # Usage
# save_password -v <user VM IP> -p <password> # save_password -v <user VM IP> -p <password>
# #
PASSWD_FILE=/var/cache/cloud/passwords
while getopts 'v:p:' OPTION while getopts 'v:p:' OPTION
do do
@ -18,17 +19,9 @@ do
esac esac
done done
if [ ! -f /root/passwords ]; [ -f $PASSWD_FILE ] || touch $PASSWD_FILE
then
touch /root/passwords;
fi
sed -i /$VM_IP/d /root/passwords sed -i /$VM_IP/d $PASSWD_FILE
echo "$VM_IP=$PASSWORD" >> /root/passwords echo "$VM_IP=$PASSWORD" >> $PASSWD_FILE
if [ $? -ne 0 ] exit $?
then
exit 1
fi
exit 0

View File

@ -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 $ # $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@ # @VERSION@
PASSWD_FILE=/var/cache/cloud/passwords
#replace a line in a file of the form key=value #replace a line in a file of the form key=value
# $1 filename # $1 filename
# $2 keyname # $2 keyname
@ -42,9 +44,9 @@ done
VIA_SSH="ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$DOMR_IP" 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 ] if [ $? -ne 0 ]
then then