Skip to content

Fix create-env bug where an empty slice of disks from the state file results in null being passed to the CPI ask the disks argument#670

Merged
jpalermo merged 1 commit intomainfrom
pr-fix-null-string-slices
Oct 31, 2024
Merged

Fix create-env bug where an empty slice of disks from the state file results in null being passed to the CPI ask the disks argument#670
jpalermo merged 1 commit intomainfrom
pr-fix-null-string-slices

Conversation

@jpalermo
Copy link
Copy Markdown

This is caused by the way the original string slice is created. If you create it using var []string, it json marshals as null Instead we need to make([]string, 0), which will json marshal as []

…results in null being passed to the CPI ask the disks argument

This is caused by the way the original string slice is created. If you create it using var []string, it json marshals as null
Instead we need to make([]string, 0), which will json marshal as []

Signed-off-by: Joseph Palermo <joseph.palermo@broadcom.com>
@jpalermo jpalermo requested a review from selzoc October 30, 2024 22:52
@jpalermo
Copy link
Copy Markdown
Author

Error seen using the vsphere cpi before this change:

Deploying:
  Creating instance 'bosh/0':
    Creating VM:
      Creating vm with stemcell cid 'sc-ca101912-4a4c-434a-9e7a-5ce2e426f6a4':
        CPI 'create_vm' method responded with error: CmdError{"type":"Unknown","message":"undefined method `map' for nil","ok_to_retry":false}

Exit code 1

@jpalermo jpalermo merged commit 5357b10 into main Oct 31, 2024
@jpalermo jpalermo deleted the pr-fix-null-string-slices branch October 31, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants