From 08169487110a95152d2e52dc0f2584f6e3b16579 Mon Sep 17 00:00:00 2001 From: pra-moh <49077256+pra-moh@users.noreply.github.com> Date: Wed, 27 Nov 2019 15:34:02 -0800 Subject: [PATCH] [config] Add 'feature' subcommand (#746) --- config/main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config/main.py b/config/main.py index 0d6753581cb0..6f2f9eeedfeb 100755 --- a/config/main.py +++ b/config/main.py @@ -2415,6 +2415,23 @@ def delete(ctx): sflow_tbl['global'].pop('agent_id') config_db.set_entry('SFLOW', 'global', sflow_tbl['global']) +# +# 'feature' command ('config feature name state') +# +@config.command('feature') +@click.argument('name', metavar='', required=True) +@click.argument('state', metavar='', required=True, type=click.Choice(["enabled", "disabled"])) +def feature_status(name, state): + """ Configure status of feature""" + config_db = ConfigDBConnector() + config_db.connect() + status_data = config_db.get_entry('FEATURE', name) + + if not status_data: + click.echo(" Feature '{}' doesn't exist".format(name)) + return + + config_db.mod_entry('FEATURE', name, {'status': state}) if __name__ == '__main__': config()