Skip to content

Conversation

@arnavbhattacharya-NS1
Copy link
Contributor

fix for when a zone is created with the networks=[]. The created zone was being attached Network 0(as it gets added to it by default when no networks field is used)

Copy link
Contributor

@fformica fformica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked nicely in my test:

create nil -> []
update [0] -> [0]
update nil -> [0]
update [] -> []

Just a comment

Comment on lines +68 to +70
if aux.Networks == nil {
aux.Networks = &[]int{}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't make assumptions on the value of Networks, and just force it to nil if NetworkIDs is nil

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly if we do that the first line becomes

create nil -> [0]

Which is the same behaviour we had with NetworksId (it's intended)

Comment on lines +66 to +70
}

if aux.Networks == nil {
aux.Networks = &[]int{}
}
Copy link
Contributor

@fformica fformica Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arnavbhattacharya-NS1 can you do this?

Suggested change
}
if aux.Networks == nil {
aux.Networks = &[]int{}
}
} else {
aux.Networks = nil
}

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.

2 participants