mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 8254: point save password to right location
This commit is contained in:
parent
80640f9d01
commit
757bd0b5e4
@ -2,6 +2,7 @@
|
||||
# Usage
|
||||
# save_password -v <user VM IP> -p <password>
|
||||
#
|
||||
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 $?
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user