summaryrefslogtreecommitdiff
path: root/src/migration-scripts/webproxy/0-to-1
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2018-12-07 20:00:14 +0100
committerChristian Poessinger <christian@poessinger.com>2018-12-07 20:00:14 +0100
commita2ef71b8878f395d4d259a75df3d68695fd7c004 (patch)
tree7c544c9368e140ef2e6363aa7aca7a194ae1a98c /src/migration-scripts/webproxy/0-to-1
parent2189e8eacc3d056a21cba8e8fb8ef32c0660ac09 (diff)
downloadvyos-1x-a2ef71b8878f395d4d259a75df3d68695fd7c004.tar.gz
vyos-1x-a2ef71b8878f395d4d259a75df3d68695fd7c004.zip
T1060: build fix for wrong config-version number
Commit 9d35610c173 ("T1060: add missing version file for webproxy") assumed that there is a webproxy config version of 0 but we already have 1. This lead to duplicate files detected by apt.
Diffstat (limited to 'src/migration-scripts/webproxy/0-to-1')
-rwxr-xr-xsrc/migration-scripts/webproxy/0-to-139
1 files changed, 0 insertions, 39 deletions
diff --git a/src/migration-scripts/webproxy/0-to-1 b/src/migration-scripts/webproxy/0-to-1
deleted file mode 100755
index 4acabba3e..000000000
--- a/src/migration-scripts/webproxy/0-to-1
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python3
-
-# migrate old style `webproxy proxy-bypass 1.2.3.4/24`
-# to new style `webproxy whitelist destination-address 1.2.3.4/24`
-
-import sys
-
-from vyos.configtree import ConfigTree
-
-if len(sys.argv) < 1:
- print("Must specify file name!")
- sys.exit(1)
-
-file_name = sys.argv[1]
-
-with open(file_name, 'r') as f:
- config_file = f.read()
-
-config = ConfigTree(config_file)
-
-cfg_webproxy_base = ['service', 'webproxy']
-if not config.exists(cfg_webproxy_base):
- # Nothing to do
- sys.exit(0)
-else:
- bypass_addresses = config.return_values(cfg_webproxy_base + ['proxy-bypass'])
- # delete old configuration node
- config.delete(cfg_webproxy_base + ['proxy-bypass'])
- for bypass_address in bypass_addresses:
- # add data to new configuration node
- config.set(cfg_webproxy_base + ['whitelist', 'destination-address'], value=bypass_address, replace=False)
-
- # save updated configuration
- try:
- with open(file_name, 'w') as f:
- f.write(config.to_string())
- except OSError as e:
- print("Failed to save the modified config: {}".format(e))
- sys.exit(1)