Skip to content

Commit 6e9be89

Browse files
committed
Adds checks for VCF module and connection
1 parent 6456bfc commit 6e9be89

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

PureStorage.FlashArray.VMware.VCF/PureStorage.FlashArray.VMware.VCF.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Created by: Cody Hosterman
55
Organization: Pure Storage, Inc.
66
Filename: PureStorage.FlashArray.VMware.VCF.psd1
7-
Version: 2.0.0.0
7+
Version: 2.0.0.1
88
Copyright: 2020 Pure Storage, Inc.
99
-------------------------------------------------------------------------
1010
Module Name: PureStorageFlashArrayVMwareVMFSPowerShell
@@ -29,7 +29,7 @@
2929
RootModule = 'PureStorage.FlashArray.VMware.VCF.psm1'
3030

3131
# Version number of this module; major.minor[.build[.revision]]
32-
ModuleVersion = '2.0.0.0'
32+
ModuleVersion = '2.0.0.1'
3333

3434
# ID used to uniquely identify this module
3535
GUID = 'd722807a-d903-490a-a1d9-418fd8d90591'

PureStorage.FlashArray.VMware.VCF/PureStorage.FlashArray.VMware.VCF.psm1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ function Initialize-PfaVcfWorkloadDomain {
8585
catch {
8686
throw "Please install PowerVCF with install-module PowerVCF."
8787
}
88+
if ($null -eq $global:sddcManager)
89+
{
90+
throw "Please connect to SDDC Manager with Request-VcfToken."
91+
}
8892
if ($psversiontable.PSEdition -ne "Core")
8993
{
9094
throw "The cmdlet Initialize-PfaVcfWorkloadDomain is only supported with PowerShell Core (7.x or later)."
@@ -94,7 +98,6 @@ function Initialize-PfaVcfWorkloadDomain {
9498
throw "iSCSI can only be specified with vVols. VMFS can only be principal storage when deployed with Fibre Channel."
9599
}
96100
Write-Progress -id 1 -Activity "VCF and Pure ESXi Host Commission Process" -Status "Verifying input" -PercentComplete 5
97-
Write-Debug -Message ($vcfpools| out-string)
98101
$ErrorActionPreference = "stop"
99102
if ($Vvol -ne $true)
100103
{
@@ -136,6 +139,7 @@ function Initialize-PfaVcfWorkloadDomain {
136139
}
137140
Write-Debug -Message $foundProtocol
138141
$vcfpools = Get-VCFNetworkPool
142+
Write-Debug -Message ($vcfpools| out-string)
139143
if (($vcfpools.name -contains $VcfNetworkPool) -ne $true)
140144
{
141145
throw "Invalid VCF network pool ($($vcfnetworkpool)). Please verify network pools with Get-VCFNetworkPool"
@@ -389,6 +393,10 @@ function Get-PfaVcfVasaProvider {
389393
catch {
390394
throw "Please install PowerVCF with install-module PowerVCF."
391395
}
396+
if ($null -eq $global:sddcManager)
397+
{
398+
throw "Please connect to SDDC Manager with Request-VcfToken."
399+
}
392400
if ($psversiontable.PSEdition -ne "Core")
393401
{
394402
throw "The cmdlet Get-PfaVcfVasaProvider is only supported with PowerShell Core (7.x or later)."
@@ -459,6 +467,10 @@ function New-PfaVcfVasaProvider {
459467
catch {
460468
throw "Please install PowerVCF with install-module PowerVCF."
461469
}
470+
if ($null -eq $global:sddcManager)
471+
{
472+
throw "Please connect to SDDC Manager with Request-VcfToken."
473+
}
462474
if ($psversiontable.PSEdition -ne "Core")
463475
{
464476
throw "The cmdlet New-PfaVcfVasaProvider is only supported with PowerShell Core (7.x or later)."

0 commit comments

Comments
 (0)