Example #1
0
func DeleteVip(vip core.Vip) error {
	// in case of failure
	oldVips, err := database.GetVips()
	if err != nil {
		return err
	}

	// apply to vipmgr
	err = vipmgr.DeleteVip(vip)
	if err != nil {
		return err
	}

	if !database.CentralStore {
		// save to backend
		err = database.DeleteVip(vip)
		if err != nil {
			// undo vipmgr action
			if uerr := vipmgr.SetVips(oldVips); uerr != nil {
				err = fmt.Errorf("%v - %v", err.Error(), uerr.Error())
			}
			return err
		}
	}
	return nil
}
Example #2
0
func GetVips() ([]core.Vip, error) {
	return database.GetVips()
}