jborean93 / omi

Open Management Infrastructure
Other
108 stars 13 forks source link

Support ubi8/RHEL as a distribution #31

Closed liamwh closed 3 years ago

liamwh commented 3 years ago
SUMMARY

Get-Distribution doesn't resolve for RHEL operating systems

OS / ENVIRONMENT

ubi8 (RHEL based) Docker container

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Linux 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Get-Content -LiteralPath /etc/os-release | ForEach-Object -Process {
>>                     if (-not $_.Trim() -or -not $_.Contains('=')) {
>>                         return
>>                     }
>>
>>                     $key, $value = $_.Split('=', 2)
>>                     if ($value.StartsWith('"')) {
>>                         $value = $value.Substring(1)
>>                     }
>>                     if ($value.EndsWith('"')) {
>>                         $value = $value.Substring(0, $value.Length - 1)
>>                     }
>>                     $osRelease.$key = $value
>>                 }
PS /root/.local/share/powershell/Modules> $osRelease

Name                           Value
----                           -----
REDHAT_BUGZILLA_PRODUCT        Red Hat Enterprise Linux 8
ID_LIKE                        fedora
REDHAT_BUGZILLA_PRODUCT_VERSI… 8.4
REDHAT_SUPPORT_PRODUCT         Red Hat Enterprise Linux
REDHAT_SUPPORT_PRODUCT_VERSION 8.4
CPE_NAME                       cpe:/o:redhat:enterprise_linux:8.4:GA
DOCUMENTATION_URL              https://access.redhat.com/documentation/red_hat_enterprise_linux/8/
PRETTY_NAME                    Red Hat Enterprise Linux 8.4 (Ootpa)
NAME                           Red Hat Enterprise Linux
VERSION_ID                     8.4
ANSI_COLOR                     0;31
HOME_URL                       https://www.redhat.com/
PLATFORM_ID                    platform:el8
ID                             rhel
VERSION                        8.4 (Ootpa)
BUG_REPORT_URL                 https://bugzilla.redhat.com/
jborean93 commented 3 years ago

Is there an actual issue that occurs when Get-Distribution doesn't resolve a distribution? The code did use to rely on it being a known one but now Get-Distribution should only be used to determine if it's a macOS or Linux distribution so would be good to see if Install-WSMan is erroring in any way..

jborean93 commented 3 years ago

I assume it's the same issue as https://github.com/jborean93/omi/issues/30. Looks like how I assumed switch statements worked is not entirely correct.

jborean93 commented 3 years ago

2.2.1 has been released to the PSGallery and should fix this problem https://www.powershellgallery.com/packages/PSWSMan/2.2.1