From 1df71b3d645234fadc77b25ce09185209a72d3c5 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 14 Jun 2022 16:14:43 +0000 Subject: [PATCH] Revert to just db.set_entry() --- config/main.py | 10 ++++------ config/validated_config_db_connector.py | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/config/main.py b/config/main.py index 34223b1853..4a4bdca1d9 100644 --- a/config/main.py +++ b/config/main.py @@ -1894,8 +1894,7 @@ def portchannel(db, ctx, namespace): def add_portchannel(ctx, portchannel_name, min_links, fallback): """Add port channel""" - db = ctx.obj['db'] - validated_db = ValidatedConfigDBConnector(db) + db = ValidatedConfigDBConnector(ctx.obj['db']) if is_portchannel_present_in_db(db, portchannel_name): ctx.fail("{} already exists!".format(portchannel_name)) @@ -1907,7 +1906,7 @@ def add_portchannel(ctx, portchannel_name, min_links, fallback): fvs['min_links'] = str(min_links) if fallback != 'false': fvs['fallback'] = 'true' - validated_db.set_entry('PORTCHANNEL', portchannel_name, fvs) + db.set_entry('PORTCHANNEL', portchannel_name, fvs) @portchannel.command('del') @click.argument('portchannel_name', metavar='', required=True) @@ -1915,13 +1914,12 @@ def add_portchannel(ctx, portchannel_name, min_links, fallback): def remove_portchannel(ctx, portchannel_name): """Remove port channel""" - db = ctx.obj['db'] - validated_db = ValidatedConfigDBConnector(db) + db = ValidatedConfigDBConnector(ctx.obj['db']) if len([(k, v) for k, v in db.get_table('PORTCHANNEL_MEMBER') if k == portchannel_name]) != 0: click.echo("Error: Portchannel {} contains members. Remove members before deleting Portchannel!".format(portchannel_name)) else: - validated_db.set_entry('PORTCHANNEL', portchannel_name, None) + db.set_entry('PORTCHANNEL', portchannel_name, None) @portchannel.group(cls=clicommon.AbbreviationGroup, name='member') @click.pass_context diff --git a/config/validated_config_db_connector.py b/config/validated_config_db_connector.py index ffb88d228a..155c1f27fd 100644 --- a/config/validated_config_db_connector.py +++ b/config/validated_config_db_connector.py @@ -6,7 +6,7 @@ class ValidatedConfigDBConnector(ConfigDBConnector): def __init__(self, db): - pass + super().__init__() def set_entry(self, table, key, value): if value: