Skip to content

Commit

Permalink
fix for ubuntu vm build (github action)
Browse files Browse the repository at this point in the history
  • Loading branch information
guirava committed Mar 13, 2024
1 parent b639b53 commit efb399e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions RubrikSecurityCloud/RubrikSecurityCloud.PowerShell/LoadModule.psm1
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#
# Load Core DLL:
#

try {
# Record the user's current working directory so that we can return to it when we
# are done loading the module
$currentPath = Get-Location

If ($PSVersionTable.PSEdition -eq "Desktop") {
Write-Output("`nLoading Rubrik Security Cloud PowerShell Module (WindowsPowerShell)...`n")
$moduleDir = Join-Path -Path $PSScriptRoot -ChildPath "net472"
Expand All @@ -12,9 +15,12 @@ try {
$moduleDir = Join-Path -Path $PSScriptRoot -ChildPath "net6.0"
}

Write-Output "LoadModule.psm1: Import-Module $modulePath"
# To ensure that help files are loaded properly, we need to change directory to the
# desired platform build (i.e. net742 or net6.0)
Set-Location -Path $moduleDir
$modulePath = Join-Path -Path $moduleDir -ChildPath "RubrikSecurityCloud.PowerShell.Dll"
$modulePath = Join-Path -Path $moduleDir -ChildPath "RubrikSecurityCloud.PowerShell.dll"

Write-Output "LoadModule.psm1: Import-Module $modulePath"
Import-Module $modulePath -ErrorAction Stop

Write-Output("Welcome to the Rubrik Security Cloud PowerShell SDK!`n")
Expand All @@ -24,3 +30,7 @@ try {
catch {
Write-Error("Unable to load Rubrik Security Cloud Module: " + $_)
}
finally {
# Ensure the working directory has been set back to the original when the script exits
Set-Location $currentPath
}

0 comments on commit efb399e

Please sign in to comment.