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

Publish-StorageCapacityHealth failing with Error at Script Line 3736 #147

Closed
4 tasks done
bhumitra opened this issue Jun 14, 2023 · 1 comment · Fixed by #148
Closed
4 tasks done

Publish-StorageCapacityHealth failing with Error at Script Line 3736 #147

bhumitra opened this issue Jun 14, 2023 · 1 comment · Fixed by #148
Assignees
Labels
bug Bug
Milestone

Comments

@bhumitra
Copy link
Contributor

Code of Conduct

  • I have read and agree to the Code of Conduct.
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

VMware Cloud Foundation

v5.0

PowerShell Version

5.1

PowerCLI Version

13.0.0

Module Version

2.1.0

PowerValidatedSolutions Version

2.3.0

PowerVCF Version

Guest Operating System

Windows Server 2019

Environment Details

No response

Description

Command is failing with VCF 5.0

Error or Debug Output

PS C:\Users\Administrator> Publish-StorageCapacityHealth -server sfo-vcf01.sfo.rainpole.io -user [email protected] -pass VMw@re1! -allDomains -outputJson C:\Users\Administrator\Desktop\vmware\hrm\logs\send-data_2023-06-13_21-04-28 -localUser vcf -localPass VMw@re1!
 [06-13-2023_21:29:02]   Error at Script Line 3736
Write-LogMessage : Cannot bind argument to parameter 'Path' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\PowerVCF\2.3.0.1004\PowerVCF.psm1:5507 char:5
+     Write-LogMessage -message " Error at Script Line $lineNumber" -co ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Write-LogMessage], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Write-LogMessage

Expected Behavior

Command should work.

Actual Behavior

Command should work without errors.
Upon debugging -

PS C:\Users\Administrator> $server = "sfo-vcf01.sfo.rainpole.io"
PS C:\Users\Administrator> $user = "[email protected]"
PS C:\Users\Administrator> $pass = "VMw@re1!"
PS C:\Users\Administrator> $localUser = "vcf"
PS C:\Users\Administrator> $localpass = "VMw@re1!"
PS C:\Users\Administrator>
PS C:\Users\Administrator>
PS C:\Users\Administrator> Request-VCFToken -fqdn sfo-vcf01.sfo.rainpole.io -username [email protected] -password VMw@re1!
Successfully Requested New API Token From SDDC Manager: sfo-vcf01.sfo.rainpole.io
PS C:\Users\Administrator>
PS C:\Users\Administrator> Test-VCFConnection -server $server
True
PS C:\Users\Administrator> Test-VCFAuthentication -server $server -user $user -pass $pass
True
PS C:\Users\Administrator>
PS C:\Users\Administrator>
PS C:\Users\Administrator> $allWorkloadDomains = Get-VCFWorkloadDomain
PS C:\Users\Administrator> $allStorageCapacityHealth = New-Object System.Collections.ArrayList
PS C:\Users\Administrator>
PS C:\Users\Administrator> foreach ($domain in $allWorkloadDomains ) {
>> Write-Output "domain = $domain"
>>     $vCenterStorageHealth = Request-VcenterStorageHealth -server $server -user $user -pass $pass -domain $domain.name; $allVcenterStorageHealth += $vCenterStorageHealth
>>     $esxiStorageCapacity = Request-EsxiStorageCapacity -server $server -user $user -pass $pass -domain $domain.name; $allEsxiStorageCapacity += $esxiStorageCapacity
>>     $datastoreStorageCapacity = Request-DatastoreStorageCapacity -server $server -user $user -pass $pass -domain $domain.name; $allDatastoreStorageCapacity += $datastoreStorageCapacity
>> }
domain = @{id=186b5e3a-fc15-4a4d-8631-e869e5d216c0; name=sfo-w01; status=ACTIVE; type=VI; vcenters=System.Object[]; ssoId=0f82dfa6-3e73-4532-89b4-9c0faedf2b34; ssoName=sfo-w01.local; isManagementSsoDomain=False; clusters=System.Object[]; nsxtCluster=; capacity=}
domain = @{id=390d4eed-2fcd-4c8e-9782-0710e4c691ec; name=sfo-m01; status=ACTIVE; type=MANAGEMENT; vcenters=System.Object[]; ssoId=825474a0-f453-4422-a556-114436e918fb; ssoName=vsphere.local; isManagementSsoDomain=True; clusters=System.Object[]; nsxtCluster=; capacity=}
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At line:5 char:128
+ ... omain.name; $allDatastoreStorageCapacity += $datastoreStorageCapacity ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound





The code needs to be fixed to explicitly define $allDatastoreStorageCapacity, $allEsxiStorageCapacity, $allVcenterStorageHealth as Arrays.

Steps to Reproduce

NA

Log Fragments and Files

No response

Screenshots

No response

References

No response

@bhumitra bhumitra added the bug Bug label Jun 14, 2023
@github-actions github-actions bot added the pending-review Pending Review label Jun 14, 2023
@tenthirtyam tenthirtyam removed the pending-review Pending Review label Jun 14, 2023
@tenthirtyam tenthirtyam added this to the v2.2.0 milestone Jun 14, 2023
bhumitra added a commit to bhumitra/powershell-module-for-vmware-cloud-foundation-reporting that referenced this issue Jun 14, 2023
bhumitra added a commit to bhumitra/powershell-module-for-vmware-cloud-foundation-reporting that referenced this issue Jun 14, 2023
Ref: vmware#147

Signed-off-by: bhumitra nagar <[email protected]>
tenthirtyam pushed a commit to bhumitra/powershell-module-for-vmware-cloud-foundation-reporting that referenced this issue Jun 14, 2023
tenthirtyam pushed a commit to bhumitra/powershell-module-for-vmware-cloud-foundation-reporting that referenced this issue Jun 14, 2023
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug
Projects
None yet
3 participants