Skip to content

Commit 25f3d03

Browse files
Usability improvements and bug fix
Fixed bug where the last net-new custom performance class was not created. In this scenario, any VPN uplink prefs that relied on it could not be restored unless the user ran the script a second time.
1 parent a96ceef commit 25f3d03

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

notebooks/Uplink preference backup and restore/merakiUplinkPreferenceRestore.ipynb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"user_data = dict()\n",
8181
"\n",
8282
"# Set the filename to use for the backup workbook\n",
83-
"WORKBOOK_FILENAME = 'exampleBackups/downloaded_rules_workbook_2020-12-03 live demo workbook.xlsx'"
83+
"WORKBOOK_FILENAME = 'exampleBackups/downloaded_rules_workbook_2020-12-01 backup with wan and vpn uplink prefs and cpcs.xlsx'"
8484
]
8585
},
8686
{
@@ -676,6 +676,9 @@
676676
"\n",
677677
"\t# If there are any orphans left, they have not matched by ID or name. Create them new.\n",
678678
"\tif len(list_of_orphan_loaded_performance_classes):\n",
679+
"\t\tprint(f'{len(list_of_orphan_loaded_performance_classes)} new custom performance classes need to be created:')\n",
680+
"\t\tprint(f'{list_of_orphan_loaded_performance_classes}\\n')\n",
681+
"\n",
679682
"\t\tfor orphan_loaded_performance_class in list_of_orphan_loaded_performance_classes:\n",
680683
"\t\t\t# Re-create the loaded class from the backup and get its new ID\n",
681684
"\t\t\t# We'll also add the old and new IDs to the reference object we've created for this purpose\n",
@@ -686,6 +689,7 @@
686689
"\t\t\t\tname=orphan_loaded_performance_class['name'],\n",
687690
"\t\t\t\tmaxLossPercentage=orphan_loaded_performance_class['maxLossPercentage']\n",
688691
"\t\t\t)\n",
692+
"\t\t\tprint(f'Created new custom performance class {new_performance_class} from the backup\\'s {orphan_loaded_performance_class}.\\n')\n",
689693
"\t\t\t\n",
690694
"\t\t\t# Add it to the name-only matches list, list_of_name_matches\n",
691695
"\t\t\tlist_of_id_updates.append(\n",
@@ -695,9 +699,8 @@
695699
"\t\t\t\t}\n",
696700
"\t\t\t)\n",
697701
"\n",
698-
"\t\t\t# Remove it from the list of orphans\n",
699-
"\t\t\tlist_of_orphan_loaded_performance_classes.remove(orphan_loaded_performance_class)\n",
700-
"\n",
702+
"\tprint('These IDs from the backup will need to be updated:')\n",
703+
"\tprint(f'{list_of_id_updates}\\n\\n')\n",
701704
"\t# Return the list of updated IDs in key-value pairs for later processing\n",
702705
"\treturn(list_of_id_updates)"
703706
]

0 commit comments

Comments
 (0)