Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle enable shell, wrapper for swssconfig from config #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

banagiri
Copy link

@banagiri banagiri commented Oct 1, 2020

- What I did

- How I did it

- How to verify it

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

@lgtm-com
Copy link

lgtm-com bot commented Oct 1, 2020

This pull request introduces 5 alerts when merging 654aed1 into 3e52604 - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Variable defined multiple times
  • 1 for Module is imported more than once

config/main.py Outdated

@switch.command('shell')
@click.pass_context
@click.argument('en', metavar='<en>', required=True, type=int)
Copy link
Contributor

Choose a reason for hiding this comment

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

How the CLI will look? will it be en=0 or en=1?

Copy link
Author

Choose a reason for hiding this comment

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

will change it to click.choice

config/main.py Outdated
with open (tmp_file) as f:
cfg = json.load(f)

cfg[0]["SWITCH_TABLE:switch"]["sdk_diag_shell"] = en
Copy link
Contributor

Choose a reason for hiding this comment

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

can you handle try catch if switch.json doesn't have "sdk_diag_shell"?

Copy link
Author

@banagiri banagiri Oct 1, 2020

Choose a reason for hiding this comment

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

py is appending this new KV pair to the list.
And swssconfig will handle unsupported attributes

config/main.py Outdated
"""switch related config"""
pass

@switch.command('shell')

Choose a reason for hiding this comment

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

Can we have more specific command , like "diag_shell" or "sdk_shell" ?

Copy link
Author

Choose a reason for hiding this comment

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

ok, will update to sdk_shell

config/main.py Outdated

@switch.command('shell')
@click.pass_context
@click.argument('en', metavar='<en>', required=True, type=int)

Choose a reason for hiding this comment

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

Instead of "int" arg, we can have it as choice arg,
@click.argument('sdk_shell', required=True, type=click.Choice(['enable', 'disable']))

@lgtm-com
Copy link

lgtm-com bot commented Oct 1, 2020

This pull request introduces 1 alert when merging 69731c0 into 3e52604 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants