Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ def add_portchannel(ctx, portchannel_name, min_links, fallback):
def remove_portchannel(ctx, portchannel_name):
"""Remove port channel"""
db = ctx.obj['db']
db.set_entry('PORTCHANNEL', portchannel_name, None)
if len(db.get_entry('PORTCHANNEL', portchannel_name)) != 0:
db.set_entry('PORTCHANNEL', portchannel_name, None)
else:
ctx.fail("{} is not configured".format(portchannel_name))


@portchannel.group('member')
@click.pass_context
Expand All @@ -474,9 +478,11 @@ def add_portchannel_member(ctx, portchannel_name, port_name):
def del_portchannel_member(ctx, portchannel_name, port_name):
"""Remove member from portchannel"""
db = ctx.obj['db']
db.set_entry('PORTCHANNEL_MEMBER', (portchannel_name, port_name), None)
db.set_entry('PORTCHANNEL_MEMBER', portchannel_name + '|' + port_name, None)

if len(db.get_entry('PORTCHANNEL_MEMBER', portchannel_name + '|' + port_namee)) != 0:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port_namee ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I have addressed it and updated the pull request.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madhupalu, i'll revert this change. Can you create a new PR that fixes this?

db.set_entry('PORTCHANNEL_MEMBER', (portchannel_name, port_name), None)
db.set_entry('PORTCHANNEL_MEMBER', portchannel_name + '|' + port_name, None)
else:
ctx.fail("{} is not part of {}".format(port_name, portchannel_name))

#
# 'mirror_session' group ('config mirror_session ...')
Expand Down