summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-03-10 10:07:19 -0600
committerJohn Estabrook <jestabro@vyos.io>2022-03-10 12:10:49 -0600
commitef4870e66f8c1cd6df5fba2abbfdde0eac152e0a (patch)
treeb79abe885d3b5392f8b2fa434cd4816833eea581 /src/helpers
parentfde48b4d303b471f8c56b81bc7fcef0a028bb60a (diff)
downloadvyos-1x-ef4870e66f8c1cd6df5fba2abbfdde0eac152e0a.tar.gz
vyos-1x-ef4870e66f8c1cd6df5fba2abbfdde0eac152e0a.zip
Revert "save-config: T4292: rewrite vyatta-save-config.pl to Python"
This reverts commit c4d389488970c8510200cac96a67182e9333b891. Revert while investigating failure in vyos-configtest.
Diffstat (limited to 'src/helpers')
-rwxr-xr-xsrc/helpers/vyos-save-config.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/helpers/vyos-save-config.py b/src/helpers/vyos-save-config.py
deleted file mode 100755
index 628d510dd..000000000
--- a/src/helpers/vyos-save-config.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2022 VyOS maintainers and contributors
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 or later as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
-import os
-import re
-import sys
-from tempfile import NamedTemporaryFile
-
-from vyos.config import Config
-from vyos.remote import urlc
-from vyos.component_version import system_footer
-
-DEFAULT_CONFIG_FILE = '/opt/vyatta/etc/config/config.boot'
-remote_save = None
-
-if len(sys.argv) > 1:
- save_file = sys.argv[1]
-else:
- save_file = DEFAULT_CONFIG_FILE
-
-if re.match(r'\w+:/', save_file):
- try:
- remote_save = urlc(save_file)
- except ValueError as e:
- sys.exit(e)
-
-config = Config()
-ct = config.get_config_tree(effective=True)
-
-write_file = save_file if remote_save is None else NamedTemporaryFile(delete=False).name
-with open(write_file, 'w') as f:
- f.write(ct.to_string())
- f.write("\n")
- f.write(system_footer())
-
-if remote_save is not None:
- try:
- remote_save.upload(write_file)
- finally:
- os.remove(write_file)