-
Notifications
You must be signed in to change notification settings - Fork 102
Respect TrustRepository parameter in RequiredResource hashtable #1910
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
Respect TrustRepository parameter in RequiredResource hashtable #1910
Conversation
Co-authored-by: adityapatwardhan <[email protected]>
…ests Co-authored-by: adityapatwardhan <[email protected]>
Co-authored-by: adityapatwardhan <[email protected]>
Co-authored-by: adityapatwardhan <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot "bool acceptLicense = reqResourceParams != null ? reqResourceParams.AcceptLicense : AcceptLicense; |
…alse This addresses the feedback to check if reqResourceParams properties are null. Now the code can distinguish between: - User didn't specify the property (null) -> use cmdlet-level parameter - User explicitly set the property to true/false -> use that value Changed properties to nullable (bool?, ScopeType?) and updated logic to only set them when explicitly provided in the RequiredResource hashtable. Co-authored-by: alerickson <[email protected]>
Updated to use nullable properties ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Plan to Fix TrustRepository in RequiredResource
Summary
This PR successfully fixes the issue where
TrustRepositoryparameter specified in the-RequiredResourcehashtable was not being respected.Root Cause
The
ProcessInstallHelpermethod inInstallPSResource.cswas always using cmdlet-level parameters (likeTrustRepository,AcceptLicense, etc.) when callingBeginInstallPackages, even whenreqResourceParamswas provided via-RequiredResource. Additionally, boolean properties couldn't distinguish between "not set" and "set to false".Solution
InstallPkgParamsnullable (bool?,ScopeType?)ProcessInstallHelperto use null-coalescing operator (??) to prefer RequiredResource values when set, otherwise fall back to cmdlet-level parametersChanges Made
InstallPkgParams.cs:
InstallPSResource.cs:
Test Coverage: Added tests for both V2 and V3 server scenarios to verify TrustRepository in RequiredResource
Review Feedback Addressed
Security
Testing
Tests verify that when TrustRepository is specified in the RequiredResource hashtable, the module installs without prompting for confirmation.
Original prompt
-RequiredResourceshould be respected #1900💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.