diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-06-27 23:39:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-27 23:39:58 +0200 |
commit | fa40d35b17f98afd363711917fbf56e97885814e (patch) | |
tree | e2edaa3cc59d804ded825cf0b94397b49f6f1eb2 /python/vyos | |
parent | 50068c7bbdb409a05684898481a7b4fbfcbb106f (diff) | |
parent | 1f428866554b6ab8364e2501a249a590e4f0f65c (diff) | |
download | vyos-1x-fa40d35b17f98afd363711917fbf56e97885814e.tar.gz vyos-1x-fa40d35b17f98afd363711917fbf56e97885814e.zip |
Merge pull request #482 from thomas-mangin/T2660
xml: T2660: do replace - with _ for defaults when not flattening
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/xml/definition.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/python/vyos/xml/definition.py b/python/vyos/xml/definition.py index e493c54c1..5421007e0 100644 --- a/python/vyos/xml/definition.py +++ b/python/vyos/xml/definition.py @@ -11,8 +11,6 @@ # You should have received a copy of the GNU Lesser General Public License along with this library; # if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from copy import deepcopy - from vyos.xml import kw # As we index by key, the name is first and then the data: @@ -253,7 +251,14 @@ class XML(dict): d = d[k] if not flat: - return deepcopy(d) + r = {} + for k in d: + under = k.replace('-','_') + if isinstance(d[k],dict): + r[under] = self.defaults(lpath + [k], flat) + continue + r[under] = d[k] + return r def _flatten(inside, index, d): r = {} |