From 3a13d1b8c063564a35284d5a82662cefe6ed0d67 Mon Sep 17 00:00:00 2001 From: Julien Stroheker Date: Mon, 16 Jul 2018 17:17:24 -0400 Subject: [PATCH] Reviews and opti. --- pkg/api/vlabs/validate.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/api/vlabs/validate.go b/pkg/api/vlabs/validate.go index 868dfe11a4..3acf628e4c 100644 --- a/pkg/api/vlabs/validate.go +++ b/pkg/api/vlabs/validate.go @@ -347,8 +347,9 @@ func (a *Properties) validateAgentPoolProfiles() error { if e := validatePoolOSType(agentPoolProfile.OSType); e != nil { return e } - if agentPoolProfile.AcceleratedNetworkingEnabled != nil { - if e := validatePoolAcceleratedNetworking(agentPoolProfile.VMSize, *agentPoolProfile.AcceleratedNetworkingEnabled); e != nil { + + if helpers.IsTrueBoolPointer(agentPoolProfile.AcceleratedNetworkingEnabled) { + if e := validatePoolAcceleratedNetworking(agentPoolProfile.VMSize); e != nil { return e } } @@ -1132,11 +1133,9 @@ func validatePoolOSType(os OSType) error { return nil } -func validatePoolAcceleratedNetworking(VMSize string, AcceleratedNetworking bool) error { - if AcceleratedNetworking { - if helpers.AcceleratedNetworkingSupported(VMSize) != AcceleratedNetworking { - return fmt.Errorf("The AgentPoolProfile.vmsize does not support AgentPoolProfile.acceleratedNetworking") - } +func validatePoolAcceleratedNetworking(VMSize string) error { + if !helpers.AcceleratedNetworkingSupported(VMSize) { + return fmt.Errorf("The AgentPoolProfile.vmsize does not support AgentPoolProfile.acceleratedNetworking") } return nil }