diff options
| author | anlan_cs <anlan_cs@tom.com> | 2021-07-06 03:15:46 -0400 |
|---|---|---|
| committer | anlan_cs <anlan_cs@tom.com> | 2021-10-09 04:15:55 -0400 |
| commit | 1bdffcf01c47af289e313c8e4edd4e308ae37d66 (patch) | |
| tree | 34ea61dc47bca7d8d8cdafcabfc3ce14a59e1891 | |
| parent | 495047b526207f36c5b4ce359ec14c7b1bb1fa5e (diff) | |
tools: fix wrong get_contexts() of Config class.
Calling get_contexts() can't display as expected, it wrongly displays:
<__main__.Context object at 0x7fdee1d5ad50>
So make it display correct data by add __str__ in Context class.
Signed-off-by: anlan_cs <anlan_cs@tom.com>
| -rwxr-xr-x | tools/frr-reload.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py index da51c231d1..a1320cad1a 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -199,6 +199,9 @@ class Context(object): for ligne in lines: self.dlines[ligne] = True + def __str__(self): + return str(self.keys) + " : " + str(self.lines) + def add_lines(self, lines): """ Add lines to specified context @@ -335,7 +338,7 @@ class Config(object): """ for (_, ctx) in sorted(iteritems(self.contexts)): - print(str(ctx) + "\n") + print(str(ctx)) def save_contexts(self, key, lines): """ |
