ar/bridge: use cni.IsCNINotInitialized helper

This commit is contained in:
Nick Ethier 2020-04-06 21:44:01 -04:00
parent 58fe326090
commit 44ad5d96d8
No known key found for this signature in database
GPG key ID: 07C1A3ECED90D24A

View file

@ -184,11 +184,11 @@ func (b *bridgeNetworkConfigurator) Teardown(ctx context.Context, alloc *structs
}
func (b *bridgeNetworkConfigurator) ensureCNIInitialized() error {
err := b.cni.Status()
if err == cni.ErrCNINotInitialized {
if err := b.cni.Status(); cni.IsCNINotInitialized(err) {
return b.cni.Load(cni.WithConfListBytes(b.buildNomadNetConfig()))
} else {
return err
}
return err
}
// getPortMapping builds a list of portMapping structs that are used as the