Skip to content
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

Install-DbaMaintenanceSolution does not work inside a container #9252

Merged

Conversation

david-garcia-garcia
Copy link
Contributor

Please read -- recent changes to our repo

On November 10, 2022, we removed some bloat from our repository (for the second and final time). This change requires that all contributors reclone or refork their repo.

PRs from repos that have not been recently reforked or recloned will be closed and @potatoqualitee will cherry-pick your commits and open a new PR with your changes.

  • Please confirm you have the smaller repo (85MB .git directory vs 275MB or 110MB or 185MB .git directory)

Type of Change

[X] Bug fix (non-breaking change, fixes # )

Purpose

Fix internet connection check inside windows containers

Approach

Remove uneeded internet connection check prior to download attempt. Current implementation already does fallback to embedded maintenance solution if download fails, so there is no need pre-check.

Inside a windows container, see output of current commands used to pre-check if an internet connection is available.

PS C:\> Get-NetConnectionProfile
Get-NetConnectionProfile : A general error occurred that is not covered by a 
more specific error code.
At line:1 char:1
+ Get-NetConnectionProfile
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_NetConnectionProfile:root/St 
   andardCi...nnectionProfile) [Get-NetConnectionProfile], CimException
    + FullyQualifiedErrorId : MI RESULT 1,Get-NetConnectionProfile
 
PS C:\> $network = [Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")
PS C:\> 
      >                     $script:internet = ([Activator]::CreateInstance($network)).GetNetworkConnections() | ForEach-Object { $_.GetNetwork().GetConnectivity() } | Where-Object { ($_ -band 64) -eq 64 }
The service cannot be started, either because it is disabled or because it has 
    + CategoryInfo          : OperationStopped: (:) [], COMException~~~~~~~     
PS C:\>ullyQualifiedErrorId : System.Runtime.InteropServices.COMException       
+ ...             $script:internet = ([Activator]::CreateInstance($network) ... 

Commands to test

Install-DbaMaintenanceSolution

Screenshots

Learning

@potatoqualitee
Copy link
Member

Thank you for your contribution, David! This fix is a bit severe. I believe when it's removed, and an internet connection does not exist, it's a bunch of red.

Instead, can you please add it back then throw an -ErrorAction SilentlyContinue on that second Get-NetConnectionProfile. See if that works better.

@potatoqualitee potatoqualitee merged commit ccaa682 into dataplat:development Mar 9, 2024
3 checks passed
@potatoqualitee
Copy link
Member

Thank you! Please let me know if this does not solve your problem.

@david-garcia-garcia
Copy link
Contributor Author

Working now! Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants