diff --git a/pkg/api/agentPoolOnlyApi/v20170831/validate.go b/pkg/api/agentPoolOnlyApi/v20170831/validate.go index 552a26b3a9..61e412aa55 100644 --- a/pkg/api/agentPoolOnlyApi/v20170831/validate.go +++ b/pkg/api/agentPoolOnlyApi/v20170831/validate.go @@ -88,10 +88,7 @@ func (a *Properties) Validate() error { return e } } - if e := validateVNET(a); e != nil { - return e - } - return nil + return validateVNET(a) } func validatePoolName(poolName string) error { diff --git a/pkg/api/agentPoolOnlyApi/v20180331/validate.go b/pkg/api/agentPoolOnlyApi/v20180331/validate.go index 5a7e3bb3a5..f37520da65 100644 --- a/pkg/api/agentPoolOnlyApi/v20180331/validate.go +++ b/pkg/api/agentPoolOnlyApi/v20180331/validate.go @@ -25,10 +25,7 @@ func init() { func (a *AgentPoolProfile) Validate() error { // Don't need to call validate.Struct(a) // It is handled by Properties.Validate() - if e := validatePoolName(a.Name); e != nil { - return e - } - return nil + return validatePoolName(a.Name) } // Validate implements APIObject diff --git a/pkg/api/agentPoolOnlyApi/vlabs/validate.go b/pkg/api/agentPoolOnlyApi/vlabs/validate.go index 34cf032a83..bde243aefe 100644 --- a/pkg/api/agentPoolOnlyApi/vlabs/validate.go +++ b/pkg/api/agentPoolOnlyApi/vlabs/validate.go @@ -78,10 +78,7 @@ func (a *Properties) Validate() error { if e := a.LinuxProfile.Validate(); e != nil { return e } - if e := validateVNET(a); e != nil { - return e - } - return nil + return validateVNET(a) } func validatePoolName(poolName string) error { diff --git a/pkg/api/v20160330/validate.go b/pkg/api/v20160330/validate.go index bf96fd7d88..a0d250b16f 100644 --- a/pkg/api/v20160330/validate.go +++ b/pkg/api/v20160330/validate.go @@ -27,10 +27,7 @@ func (m *MasterProfile) Validate() error { if e := validateName(m.DNSPrefix, "MasterProfile.DNSPrefix"); e != nil { return e } - if e := validateDNSName(m.DNSPrefix); e != nil { - return e - } - return nil + return validateDNSName(m.DNSPrefix) } // Validate implements APIObject @@ -63,10 +60,7 @@ func (l *LinuxProfile) Validate() error { if len(l.SSH.PublicKeys) != 1 { return errors.New("LinuxProfile.PublicKeys requires only 1 SSH Key") } - if e := validateName(l.SSH.PublicKeys[0].KeyData, "LinuxProfile.PublicKeys.KeyData"); e != nil { - return e - } - return nil + return validateName(l.SSH.PublicKeys[0].KeyData, "LinuxProfile.PublicKeys.KeyData") } // Validate implements APIObject diff --git a/pkg/api/v20160930/validate.go b/pkg/api/v20160930/validate.go index 0183248c38..89dbf8c6a7 100644 --- a/pkg/api/v20160930/validate.go +++ b/pkg/api/v20160930/validate.go @@ -28,10 +28,7 @@ func (m *MasterProfile) Validate() error { if e := validateName(m.DNSPrefix, "MasterProfile.DNSPrefix"); e != nil { return e } - if e := validateDNSName(m.DNSPrefix); e != nil { - return e - } - return nil + return validateDNSName(m.DNSPrefix) } // Validate implements APIObject @@ -71,10 +68,7 @@ func (l *LinuxProfile) Validate() error { if len(l.SSH.PublicKeys) != 1 { return errors.New("LinuxProfile.PublicKeys requires only 1 SSH Key") } - if e := validateName(l.SSH.PublicKeys[0].KeyData, "LinuxProfile.PublicKeys.KeyData"); e != nil { - return e - } - return nil + return validateName(l.SSH.PublicKeys[0].KeyData, "LinuxProfile.PublicKeys.KeyData") } // Validate implements APIObject diff --git a/pkg/api/v20170131/validate.go b/pkg/api/v20170131/validate.go index b76a845acd..26f5957401 100644 --- a/pkg/api/v20170131/validate.go +++ b/pkg/api/v20170131/validate.go @@ -29,10 +29,7 @@ func (m *MasterProfile) Validate() error { if e := validateName(m.DNSPrefix, "MasterProfile.DNSPrefix"); e != nil { return e } - if e := validateDNSName(m.DNSPrefix); e != nil { - return e - } - return nil + return validateDNSName(m.DNSPrefix) } // Validate implements APIObject @@ -72,10 +69,7 @@ func (l *LinuxProfile) Validate() error { if len(l.SSH.PublicKeys) != 1 { return errors.New("LinuxProfile.PublicKeys requires only 1 SSH Key") } - if e := validateName(l.SSH.PublicKeys[0].KeyData, "LinuxProfile.PublicKeys.KeyData"); e != nil { - return e - } - return nil + return validateName(l.SSH.PublicKeys[0].KeyData, "LinuxProfile.PublicKeys.KeyData") } // Validate implements APIObject @@ -132,10 +126,7 @@ func (a *Properties) Validate() error { if e := a.LinuxProfile.Validate(); e != nil { return e } - if e := a.OrchestratorProfile.Validate(); e != nil { - return e - } - return nil + return a.OrchestratorProfile.Validate() } func validateNameEmpty(name string, label string) error { diff --git a/pkg/api/v20170701/validate.go b/pkg/api/v20170701/validate.go index bf5e67345a..2d28ecaefb 100644 --- a/pkg/api/v20170701/validate.go +++ b/pkg/api/v20170701/validate.go @@ -192,10 +192,7 @@ func (a *Properties) Validate(isUpdate bool) error { if e := a.LinuxProfile.Validate(); e != nil { return e } - if e := validateVNET(a); e != nil { - return e - } - return nil + return validateVNET(a) } func validatePoolName(poolName string) error { diff --git a/pkg/api/vlabs/validate.go b/pkg/api/vlabs/validate.go index d9bb4621b9..0150382ffd 100644 --- a/pkg/api/vlabs/validate.go +++ b/pkg/api/vlabs/validate.go @@ -395,10 +395,7 @@ func (l *LinuxProfile) Validate() error { if e := validate.Var(l.SSH.PublicKeys[0].KeyData, "required"); e != nil { return fmt.Errorf("KeyData in LinuxProfile.SSH.PublicKeys cannot be empty string") } - if e := validateKeyVaultSecrets(l.Secrets, false); e != nil { - return e - } - return nil + return validateKeyVaultSecrets(l.Secrets, false) } func handleValidationErrors(e validator.ValidationErrors) error { @@ -416,10 +413,7 @@ func (w *WindowsProfile) Validate() error { if e := validate.Var(w.AdminPassword, "required"); e != nil { return fmt.Errorf("WindowsProfile.AdminPassword is required, when agent pool specifies windows") } - if e := validateKeyVaultSecrets(w.Secrets, true); e != nil { - return e - } - return nil + return validateKeyVaultSecrets(w.Secrets, true) } // Validate implements APIObject diff --git a/pkg/operations/kubernetesupgrade/upgrader.go b/pkg/operations/kubernetesupgrade/upgrader.go index 547834513f..a48ea44b72 100644 --- a/pkg/operations/kubernetesupgrade/upgrader.go +++ b/pkg/operations/kubernetesupgrade/upgrader.go @@ -55,11 +55,7 @@ func (ku *Upgrader) RunUpgrade() error { return err } - if err := ku.upgradeAgentPools(); err != nil { - return err - } - - return nil + return ku.upgradeAgentPools() } // Validate will run validation post upgrade