Respect TrustRepository parameter in RequiredResource hashtable#1910
Respect TrustRepository parameter in RequiredResource hashtable#1910adityapatwardhan merged 6 commits intomasterfrom
Conversation
Co-authored-by: adityapatwardhan <12820925+adityapatwardhan@users.noreply.github.com>
…ests Co-authored-by: adityapatwardhan <12820925+adityapatwardhan@users.noreply.github.com>
Co-authored-by: adityapatwardhan <12820925+adityapatwardhan@users.noreply.github.com>
Co-authored-by: adityapatwardhan <12820925+adityapatwardhan@users.noreply.github.com>
|
/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 <25858831+alerickson@users.noreply.github.com>
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.