summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-08-11 11:03:15 +0300
committerGitHub <noreply@github.com>2023-08-11 11:03:15 +0300
commit43294da10313198c4f71f46eb39c4276551ad118 (patch)
treeb35c2ec7912133411f0b7e49c58af58bee7d9848 /python
parent4659f25804bd1b534767c134247c24699aaca722 (diff)
parentd64d3b179ce487aa6b442c397c4bb3bb1f572155 (diff)
downloadvyos-1x-43294da10313198c4f71f46eb39c4276551ad118.tar.gz
vyos-1x-43294da10313198c4f71f46eb39c4276551ad118.zip
Merge pull request #2147 from jestabro/remaining-defaults
T5434: remove reamining calls to incorrect defaults
Diffstat (limited to 'python')
-rw-r--r--python/vyos/component_version.py2
-rw-r--r--python/vyos/configdict.py1
-rw-r--r--python/vyos/configdiff.py18
-rw-r--r--python/vyos/xml_ref/definition.py2
4 files changed, 15 insertions, 8 deletions
diff --git a/python/vyos/component_version.py b/python/vyos/component_version.py
index a4e318d08..84e0ae51a 100644
--- a/python/vyos/component_version.py
+++ b/python/vyos/component_version.py
@@ -37,7 +37,7 @@ import re
import sys
import fileinput
-from vyos.xml import component_version
+from vyos.xml_ref import component_version
from vyos.version import get_version
from vyos.defaults import directories
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 2a47e88f9..71a06b625 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -20,7 +20,6 @@ import os
import json
from vyos.utils.dict import dict_search
-from vyos.xml import defaults
from vyos.utils.process import cmd
def retrieve_config(path_hash, base_path, config):
diff --git a/python/vyos/configdiff.py b/python/vyos/configdiff.py
index 0caa204c3..1ec2dfafe 100644
--- a/python/vyos/configdiff.py
+++ b/python/vyos/configdiff.py
@@ -22,7 +22,7 @@ from vyos.configdict import list_diff
from vyos.utils.dict import get_sub_dict
from vyos.utils.dict import mangle_dict_keys
from vyos.utils.dict import dict_search_args
-from vyos.xml import defaults
+from vyos.xml_ref import get_defaults
class ConfigDiffError(Exception):
"""
@@ -240,7 +240,9 @@ class ConfigDiff(object):
if self._key_mangling:
ret[k] = self._mangle_dict_keys(ret[k])
if k in target_defaults and not no_defaults:
- default_values = defaults(self._make_path(path))
+ default_values = get_defaults(self._make_path(path),
+ get_first_key=True,
+ recursive=True)
ret[k] = dict_merge(default_values, ret[k])
return ret
@@ -264,7 +266,9 @@ class ConfigDiff(object):
ret[k] = self._mangle_dict_keys(ret[k])
if k in target_defaults and not no_defaults:
- default_values = defaults(self._make_path(path))
+ default_values = get_defaults(self._make_path(path),
+ get_first_key=True,
+ recursive=True)
ret[k] = dict_merge(default_values, ret[k])
return ret
@@ -312,7 +316,9 @@ class ConfigDiff(object):
if self._key_mangling:
ret[k] = self._mangle_dict_keys(ret[k])
if k in target_defaults and not no_defaults:
- default_values = defaults(self._make_path(path))
+ default_values = get_defaults(self._make_path(path),
+ get_first_key=True,
+ recursive=True)
ret[k] = dict_merge(default_values, ret[k])
return ret
@@ -335,7 +341,9 @@ class ConfigDiff(object):
ret[k] = self._mangle_dict_keys(ret[k])
if k in target_defaults and not no_defaults:
- default_values = defaults(self._make_path(path))
+ default_values = get_defaults(self._make_path(path),
+ get_first_key=True,
+ recursive=True)
ret[k] = dict_merge(default_values, ret[k])
return ret
diff --git a/python/vyos/xml_ref/definition.py b/python/vyos/xml_ref/definition.py
index 38e07f0a7..c90c5ddbc 100644
--- a/python/vyos/xml_ref/definition.py
+++ b/python/vyos/xml_ref/definition.py
@@ -162,7 +162,7 @@ class Xml:
def component_version(self) -> dict:
d = {}
- for k, v in self.ref['component_version']:
+ for k, v in self.ref['component_version'].items():
d[k] = int(v)
return d