mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 02:45:42 +03:00
autopilot: correctly return errors within state functions. (#12714)
This commit is contained in:
@@ -49,10 +49,11 @@ func (s *StateStore) AutopilotSetConfig(index uint64, config *structs.AutopilotC
|
||||
tx := s.db.WriteTxn(index)
|
||||
defer tx.Abort()
|
||||
|
||||
s.autopilotSetConfigTxn(index, tx, config)
|
||||
if err := s.autopilotSetConfigTxn(index, tx, config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return nil
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
// AutopilotCASConfig is used to try updating the Autopilot configuration with a
|
||||
@@ -76,10 +77,12 @@ func (s *StateStore) AutopilotCASConfig(index, cidx uint64, config *structs.Auto
|
||||
return false, nil
|
||||
}
|
||||
|
||||
s.autopilotSetConfigTxn(index, tx, config)
|
||||
if err := s.autopilotSetConfigTxn(index, tx, config); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
err = tx.Commit()
|
||||
return err == nil, err
|
||||
}
|
||||
|
||||
func (s *StateStore) autopilotSetConfigTxn(idx uint64, tx *txn, config *structs.AutopilotConfig) error {
|
||||
|
||||
Reference in New Issue
Block a user