engine: resources: net: Allow addr without gateway

In some scenarios it is desirable to set the addrs and gateway
independently, i.e. if a default gateway is already set on
the machine. This patch removes the requirement to set them
together.
This commit is contained in:
Jonathan Gold
2018-04-05 08:24:10 -04:00
parent d2ce70a673
commit 9b5c4c50e7

View File

@@ -119,9 +119,6 @@ func (obj *NetRes) Validate() error {
} }
// validate network address input // validate network address input
if (obj.Addrs == nil) != (obj.Gateway == "") {
return fmt.Errorf("addrs and gateway must both be set or both be empty")
}
if obj.Addrs != nil { if obj.Addrs != nil {
for _, addr := range obj.Addrs { for _, addr := range obj.Addrs {
if _, _, err := net.ParseCIDR(addr); err != nil { if _, _, err := net.ParseCIDR(addr); err != nil {