dsccommunity / DscWorkshop

Blueprint for a full featured DSC project for Push / Pull with or without CI/CD
MIT License
203 stars 162 forks source link

Remove unnecessary -ListAvailable which triggers a Warning in Offline Environments and wastes time. #165

Closed ChristophHannappel closed 7 months ago

ChristophHannappel commented 9 months ago

Removed unnecessary -ListAvailable

Pull Request

Pull Request (PR) description

Resolve-Dependency.ps1 uses the following Line to determine if the nuget Package Provider is installed:

# Install the package provider if it is not available.
$nuGetProvider = Get-PackageProvider -Name 'NuGet' -ListAvailable | Select-Object -First 1

Using -ListAvailable triggers a webrequest which displays the available providers with this Name.

PS > Measure-Command {Get-PackageProvider -Name nuget} Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 13 Ticks : 136945 TotalDays : 1,58501157407407E-07 TotalHours : 3,80402777777778E-06 TotalMinutes : 0,000228241666666667 TotalSeconds : 0,0136945 TotalMilliseconds : 13,6945



### Fixed
Removed a `-ListAvailable` from the `Get-PackageProvider` at `Resolve-Dependency.ps1` which could lead to false positives, creates a warning in offline Build Servers and slows down the process.

## Task list

<!--
    To aid community reviewers in reviewing and merging your PR, please take
    the time to run through the below checklist and make sure your PR has
    everything updated as required.

    Change to [x] for each task in the task list that applies to your PR.
    For those task that don't apply to you PR, leave those as is.
-->

- [X] The PR represents a single logical change. i.e. Cosmetic updates should go in different PRs.
- [ ] Added an entry under the Unreleased section of in the CHANGELOG.md as per [format](https://keepachangelog.com/en/1.0.0/).
- [X] Local clean build passes without issue or fail tests (`build.ps1 -ResolveDependency`).
- [ ] Resource documentation added/updated in README.md.
- [ ] Resource parameter descriptions added/updated in README.md, schema.mof
      and comment-based help.
- [ ] Comment-based help added/updated.
- [ ] Localization strings added/updated in all localization files as appropriate.
- [ ] Examples appropriately added/updated.
- [ ] Unit tests added/updated. See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md).
- [ ] Integration tests added/updated (where possible). See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md).
- [X] New/changed code adheres to [DSC Resource Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md) and [Best Practices](https://github.com/PowerShell/DscResources/blob/master/BestPractices.md).

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/dsccommunity/DscWorkshop/165)
<!-- Reviewable:end -->