summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsever-sever <v.gletenko@vyos.io>2021-01-18 12:00:24 +0000
committerDaniil Baturin <daniil@baturin.org>2021-01-18 13:18:01 +0100
commit8efa50b7f0d5a84b5eb98353465911bc8aa292fe (patch)
treec65e9ad5993124e9f530846fe43f40349319ef70
parentbe8601fde6053206139d4bf7d803104f510f707f (diff)
downloadvyatta-cfg-quagga-8efa50b7f0d5a84b5eb98353465911bc8aa292fe.tar.gz
vyatta-cfg-quagga-8efa50b7f0d5a84b5eb98353465911bc8aa292fe.zip
rpki: T3230: Fix delete section for protocol rpki
-rw-r--r--scripts/vyos-update-rpki-cache.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/vyos-update-rpki-cache.py b/scripts/vyos-update-rpki-cache.py
index 1b5bee96..df6f01bc 100644
--- a/scripts/vyos-update-rpki-cache.py
+++ b/scripts/vyos-update-rpki-cache.py
@@ -39,6 +39,13 @@ def create_cache(c, cache):
def delete_cache(c, cache):
ssh = False
+ port = c.return_effective_value(base_path + "cache {0} port".format(cache))
+ addr = c.return_effective_value(base_path + "cache {0} address".format(cache))
+ pref = c.return_effective_value(base_path + "cache {0} preference".format(cache))
+
+ if not pref:
+ pref = 1
+
if c.exists_effective(base_path + "cache {0} ssh".format(cache)):
ssh = True
user = c.return_effective_value(base_path + "cache {0} ssh username".format(cache))
@@ -46,17 +53,11 @@ def delete_cache(c, cache):
privkey = c.return_effective_value(base_path + "cache {0} ssh private-key-file".format(cache))
known_hosts = c.return_effective_value(base_path + "cache {0} ssh known-hosts-file".format(cache))
- port = c.return_effective_value(base_path + "cache {0} port".format(cache))
- addr = c.return_effective_value(base_path + "cache {0} address".format(cache))
- pref = c.return_effective_value(base_path + "cache {0} preference".format(cache))
-
- if not pref:
- pref = 1
-
if ssh:
subprocess.call(""" vtysh -c 'conf t' -c 'rpki' -c 'no rpki cache {0} {1} {2} {3} {4} {5} preference {6}' """.format(addr, port, user, privkey, pubkey, known_hosts, pref), shell=True)
- else:
- subprocess.call(""" vtysh -c 'conf t' -c 'rpki' -c 'no rpki cache {0} {1} preference {2}' """.format(addr, port, pref), shell=True)
+
+ else:
+ subprocess.call(""" vtysh -c 'conf t' -c 'rpki' -c 'no rpki cache {0} {1} preference {2}' """.format(addr, port, pref), shell=True)
config = vyos.config.Config()