enabled flag#12
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds an "Enabled" flag feature to the Aruba ClearPass AnyCA Gateway plugin and updates the project to support multiple .NET frameworks. The enabled flag allows administrators to disable gateway functionality while keeping the CA configuration intact, primarily for scenarios where the CA needs to be created before all configuration information is available.
- Added an Enabled configuration parameter with default value of true
- Updated project to support both .NET 6.0 and .NET 8.0 frameworks
- Modified gateway operations to check the enabled flag before executing
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| integration-manifest.json | Updated schema URL and added release_project field, plus new Enabled configuration parameter |
| aruba-clearpass-caplugin.csproj | Changed from single .NET 6.0 target to multi-target .NET 6.0 and 8.0 |
| Constants.cs | Added Enabled constant for configuration key |
| ArubaClearPassConfig.cs | Added Enabled boolean property with default value of true |
| ArubaClearPassCAPlugin.cs | Implemented enabled flag checks in Ping and ValidateCAConnectionInfo methods, added configuration annotations |
| aruba-clearpass-caplugin.sln | Updated Visual Studio version |
| README.md | Updated documentation to reflect dual framework support and new Enabled parameter |
| CHANGELOG.md | Added version 1.1.0 entry documenting the new features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| try | ||
| { | ||
| if (!(bool)connectionInfo[ArubaClearPassConstants.Config.Enabled]) | ||
| { | ||
| _logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation..."); | ||
| _logger.MethodExit(LogLevel.Trace); | ||
| return; | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); | ||
| } | ||
|
|
||
| _logger.LogInformation("Validating CA Connection Info"); | ||
|
|
||
| List<string> errors = new List<string>(); |
There was a problem hiding this comment.
The catch block swallows exceptions without re-throwing or handling the case where the Enabled key is missing. If the key doesn't exist or has an invalid type, the method will continue execution instead of properly handling the error condition.
| try | |
| { | |
| if (!(bool)connectionInfo[ArubaClearPassConstants.Config.Enabled]) | |
| { | |
| _logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation..."); | |
| _logger.MethodExit(LogLevel.Trace); | |
| return; | |
| } | |
| } | |
| catch (Exception ex) | |
| { | |
| _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); | |
| } | |
| _logger.LogInformation("Validating CA Connection Info"); | |
| List<string> errors = new List<string>(); | |
| List<string> errors = new List<string>(); | |
| // Check for the Enabled key and its type | |
| if (!connectionInfo.ContainsKey(ArubaClearPassConstants.Config.Enabled) || !(connectionInfo[ArubaClearPassConstants.Config.Enabled] is bool)) | |
| { | |
| errors.Add("The 'Enabled' key is missing or not a boolean in the connection info."); | |
| } | |
| else if (!(bool)connectionInfo[ArubaClearPassConstants.Config.Enabled]) | |
| { | |
| _logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation..."); | |
| _logger.MethodExit(LogLevel.Trace); | |
| return; | |
| } | |
| _logger.LogInformation("Validating CA Connection Info"); | |
| // errors list is already initialized above |
Feature 76628