[Nexthop][fboss2-dev] Add a command to clear config sessions#935
Closed
benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
Closed
[Nexthop][fboss2-dev] Add a command to clear config sessions#935benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
benoit-nexthop wants to merge 1 commit intofacebook:mainfrom
Conversation
2 tasks
98a743b to
17ab4f8
Compare
meta-codesync Bot
pushed a commit
that referenced
this pull request
Mar 27, 2026
Summary: **Pre-submission checklist** - [x] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install` - [x] `pre-commit run` Move explicit template instantiations from the monolithic `CmdHandlerImplConfig.cpp` file to individual command `.cpp` files. This is the first step in refactoring the CLI command registration system to avoid creating a monolithic include file. The non-config commands will be done in a separate PR. Changes: - Created 11 new `.cpp` files for stub commands that were missing them - Added template instantiations to 20 existing command `.cpp` files - Updated `cmake/CliFboss2.cmake` and `fboss/cli/fboss2/BUCK` build files - Deleted `fboss/cli/fboss2/CmdHandlerImplConfig.cpp` Each command `.cpp` file now includes `CmdHandler.cpp` and has its own explicit template instantiation, following the pattern: ```c++ #include "fboss/cli/fboss2/CmdHandler.cpp" template void CmdHandler<CmdClass, CmdClassTraits>::run(); ``` Original change by manoharan-nexthop Note: this change is part of a series, the previous one is #919, the next one is #935. Pull Request resolved: #931 Test Plan: Ran all the unit tests. Reviewed By: KevinYakar Differential Revision: D98510944 Pulled By: joseph5wu fbshipit-source-id: 18f33d1014eb81a81b264c65adb4bd5b78e824c4
# Summary Implements a new CLI command fboss2-dev config session clear that removes the current config session files (~/.fboss2/agent.conf and ~/.fboss2/cli_metadata.json). This command allows users to discard any pending config session changes without committing them, providing a clean way to abandon a session and start fresh. ## Changes - Added CmdConfigSessionClear.h and CmdConfigSessionClear.cpp implementing the clear command - Registered the command in CmdListConfig.cpp under config session subcommands - Added unit tests in CmdConfigSessionTest.cpp covering: - Clearing an existing session removes both files - Clearing when no session exists (no-op) - Clearing with partial session state (only config file exists) - Added e2e test in ConfigSessionClearTest.cpp that creates a session and clears it # Test Plan New E2E and unit tests. ## Sample usage ``` [admin@fboss101 .fboss2]$ fboss2-dev config session clear Config session cleared successfully. [admin@fboss101 .fboss2]$ fboss2-dev config session clear No config session exists. Nothing to clear. ```
17ab4f8 to
d054221
Compare
Contributor
|
@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D98555036. |
Contributor
|
@joseph5wu merged this pull request in d163773. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
Implements a new CLI command
fboss2-dev config session clearthat removes the current config session files (~/.fboss2/agent.confand~/.fboss2/cli_metadata.json).This command allows users to discard any pending config session changes without committing them, providing a clean way to abandon a session and start fresh.
Original change by @hillol-nexthop
Note: this change is part of a series, the previous one is #931.
Changes
CmdConfigSessionClear.handCmdConfigSessionClear.cppimplementing the clear commandCmdListConfig.cppunder config session subcommandsCmdConfigSessionTest.cppcovering:ConfigSessionClearTest.cppthat creates a session and clears itCmdConfigSessionClearTest.cppTest Plan
New E2E and unit tests.
Sample usage