wgeasy - fix migration order (#2628)

* wgeasy - fix migration order

* add another failsafe
This commit is contained in:
Stavros Kois
2024-07-02 21:57:24 +03:00
committed by GitHub
parent 790ce8f0a1
commit 57cb4093fa
2 changed files with 11 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ description: WG-Easy is the easiest way to install & manage WireGuard!
annotations:
title: WG Easy
type: application
version: 2.0.18
version: 2.0.19
apiVersion: v2
appVersion: '13'
kubeVersion: '>=1.16.0-0'

View File

@@ -37,6 +37,7 @@ def migrate_common_lib(values):
# Migrate Config
'wgConfig': {
'host': values['wgeasy']['host'],
'externalPort': values.get('wgUDPPort', 30057),
'password': values['wgeasy'].get('password', ''),
'keepAlive': values['wgeasy']['keep_alive'],
'clientMTU': values['wgeasy']['client_mtu'],
@@ -74,17 +75,22 @@ def migrate_common_lib(values):
return values
def migrate(values):
if not 'wgeasy' in values.keys():
# If we have migrated...
if 'wgConfig' in values.keys():
# Make sure the externalPort is not missing.
if not values['wgConfig'].get('externalPort', None):
values['wgConfig']['externalPort'] = values['wgNetwork'].get('udpPort', 30057)
return values
if not values['wgConfig'].get('externalPort', None):
values['wgConfig']['externalPort'] = values['wgNetwork'].get('udpPort', 30057)
# If this key is missing, we have already migrated.
if 'wgeasy' not in values.keys():
return values
return migrate_common_lib(values)
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)