From 1d58ec6d708a80066e7334505a0fc07cb8d3c607 Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Mon, 5 Aug 2019 01:36:10 +0200 Subject: [PATCH] fix(network_manager_networks): properly override port --- .../network_manager_networks/files/connection.jinja | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openvpn/network_manager_networks/files/connection.jinja b/openvpn/network_manager_networks/files/connection.jinja index b99f36c..4e08a9a 100644 --- a/openvpn/network_manager_networks/files/connection.jinja +++ b/openvpn/network_manager_networks/files/connection.jinja @@ -46,21 +46,24 @@ auth={{ vpn_data.pop('auths')|first }} {%- endif %} {%- set remote = vpn_data.pop('remote', False) %} -{%- set port = vpn_data.pop('port', 1194) %} +{%- set port = vpn_data.pop('port', False) %} {%- if remote is iterable and not remote is string %} {%- set remote = remote|first %} {%- endif %} {%- if remote is string %} {%- set remote_pair = remote.split(' ') %} {%- set remote = remote_pair|first %} -{%- if remote_pair|length > 1 %} +{%- if not port and remote_pair|length > 1 %} {%- set port = remote_pair|last %} {%- endif %} {%- endif %} -{%- if remote and port %} +{%- if remote %} remote={{ remote }} -port={{ port }} {%- endif %} +{%- if not port %} +{%- set port = 1194 %} +{%- endif %} +port={{ port }} {%- if 'tls_auth' in vpn_data %} ta-dir={{ multipart_param(vpn_data.tls_auth, 1) }}