Updated Branches:
  refs/heads/master 24c0513ee -> 27ce69fd5

CLOUDSTACK-5066: Don't remove the current VPN users when updating

If one VPN user and password is existed in current setup, then don't touch it,
otherwise would result in this user's existing connection be dropped.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/27ce69fd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/27ce69fd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/27ce69fd

Branch: refs/heads/master
Commit: 27ce69fd556991f8860444c78efd1d329d57f852
Parents: 24c0513
Author: Sheng Yang <[email protected]>
Authored: Wed Nov 6 15:30:09 2013 -0800
Committer: Sheng Yang <[email protected]>
Committed: Wed Nov 6 15:32:08 2013 -0800

----------------------------------------------------------------------
 systemvm/patches/debian/vpn/opt/cloud/bin/vpn_l2tp.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27ce69fd/systemvm/patches/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/vpn/opt/cloud/bin/vpn_l2tp.sh 
b/systemvm/patches/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
index 86148a3..5afe009 100755
--- a/systemvm/patches/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
+++ b/systemvm/patches/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
@@ -150,8 +150,12 @@ add_l2tp_ipsec_user() {
    local u=$1
    local passwd=$2
 
-   remove_l2tp_ipsec_user $u
-   echo "$u * $passwd *" >> /etc/ppp/chap-secrets
+   uptodate=$(grep "^$u \* $passwd \*$" /etc/ppp/chap-secrets)
+   if [ "$uptodate" == "" ]
+   then
+       remove_l2tp_ipsec_user $u
+       echo "$u * $passwd *" >> /etc/ppp/chap-secrets
+   fi
 }
 
 rflag=

Reply via email to