Updated Branches:
  refs/heads/4.2 721567754 -> 004efe1c0

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/004efe1c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/004efe1c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/004efe1c

Branch: refs/heads/4.2
Commit: 004efe1c0fe0e5cd1a947e7711cd2020d8ae5423
Parents: 7215677
Author: Sheng Yang <[email protected]>
Authored: Wed Nov 6 15:30:09 2013 -0800
Committer: Sheng Yang <[email protected]>
Committed: Wed Nov 6 15:30:09 2013 -0800

----------------------------------------------------------------------
 patches/systemvm/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/004efe1c/patches/systemvm/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/vpn/opt/cloud/bin/vpn_l2tp.sh 
b/patches/systemvm/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
index 79661c8..bad28f7 100755
--- a/patches/systemvm/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
+++ b/patches/systemvm/debian/vpn/opt/cloud/bin/vpn_l2tp.sh
@@ -123,8 +123,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