summaryrefslogtreecommitdiff
path: root/util/cpt_upgraders/etherswitch.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/cpt_upgraders/etherswitch.py')
-rw-r--r--util/cpt_upgraders/etherswitch.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/util/cpt_upgraders/etherswitch.py b/util/cpt_upgraders/etherswitch.py
index e4094f97d..9cd82a2d0 100644
--- a/util/cpt_upgraders/etherswitch.py
+++ b/util/cpt_upgraders/etherswitch.py
@@ -4,18 +4,19 @@ def upgrader(cpt):
options = cpt.items(sec)
for it in options:
opt_split = it[0].split('.')
+ if len(opt_split) < 2: continue
new_sec_name = opt_split[1]
old_opt_name = opt_split[len(opt_split) - 1]
if "outputFifo" in new_sec_name:
new_sec_name = new_sec_name.rstrip("outputFifo")
new_sec_name += ".outputFifo"
- new_sec_name = "system.system.%s" %(new_sec_name)
- if not cpt.has_section(new_sec_name):
- cpt.add_section(new_sec_name)
- if old_opt_name == "size":
- cpt.set(new_sec_name, "_size", it[1])
- elif old_opt_name == "packets":
- cpt.set(new_sec_name, "fifosize", it[1])
- else:
- cpt.set(new_sec_name, old_opt_name, it[1])
- cpt.remove_option(sec, it[0])
+ new_sec_name = "system.system.%s" %(new_sec_name)
+ if not cpt.has_section(new_sec_name):
+ cpt.add_section(new_sec_name)
+ if old_opt_name == "size":
+ cpt.set(new_sec_name, "_size", it[1])
+ elif old_opt_name == "packets":
+ cpt.set(new_sec_name, "fifosize", it[1])
+ else:
+ cpt.set(new_sec_name, old_opt_name, it[1])
+ cpt.remove_option(sec, it[0])