Allow both ports and networks in openstack builder

Current code would throw an index out of range exception when trying to access `s.Networks[len(s.Networks)]` when `len(s.Ports)>0` and would ignore the first `len(s.Ports)` entries of `s.Networks`, fix by shifting access to `s.Networks` back by `len(s.Ports)` so that the final read is `networks[len(s.Networks)+len(s.Ports)-1].UUID=s.Networks[len(s.Networks)+len(s.Ports)-1-len(s.Ports)]` which is necessarily the last member of `s.Networks`
This commit is contained in:
bh9 2019-04-01 11:43:21 +01:00 committed by GitHub
parent 605180f058
commit cbbbc451b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ func (s *StepRunSourceServer) Run(_ context.Context, state multistep.StateBag) m
networks[i].Port = s.Ports[i]
}
for ; i < len(networks); i++ {
networks[i].UUID = s.Networks[i]
networks[i].UUID = s.Networks[i-len(s.Ports)]
}
userData := []byte(s.UserData)