Skip to content

fix: convert domain_id list before setting it on network offering create - #343

Open
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:fix/network-offering-domainid-panic
Open

fix: convert domain_id list before setting it on network offering create#343
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:fix/network-offering-domainid-panic

Conversation

@nagaboinaramgopal

@nagaboinaramgopal nagaboinaramgopal commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

domain_id on cloudstack_network_offering is a schema.TypeList, so the SDK returns []interface{}, but create asserted v.([]string) and panicked with interface conversion: interface {} is []interface {}, not []string when domain_id is set. Fixed by building a []string, which is what the create SetDomainid takes.

Testing

Added a unit test TestNetworkOfferingDomainIdDoesNotPanic that runs the create function with domain_id set against an unreachable endpoint. It needs no live CloudStack:

go test ./cloudstack/ -run TestNetworkOfferingDomainIdDoesNotPanic

It panics against the current code and passes with the fix.

domain_id is a schema.TypeList, so the SDK returns []interface{}, but create asserted v.([]string) and panicked with an interface conversion error when domain_id is set. Build a []string, which is what the create SetDomainid takes.
@nagaboinaramgopal
nagaboinaramgopal force-pushed the fix/network-offering-domainid-panic branch from 18b3d0f to 6ca6071 Compare September 7, 2026 19:07
@nagaboinaramgopal nagaboinaramgopal changed the title fix: convert domain_id list before setting it on network offering create and update fix: convert domain_id list before setting it on network offering create Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant