🐛 Use OldHostname when querying the Database
In BaseRule.baseUpdate our goal is to check if a hostname exists before trying to rename that hostname into something else. This patch fixes an error where the newly generated Hostname was used to check for the existence of the old hostname.
This commit is contained in:
parent
ce4d469466
commit
f0118ab8ea
|
@ -32,7 +32,7 @@ func (br *BaseRule) baseInsert(category string, hostname string, paramsJSON []by
|
||||||
}
|
}
|
||||||
|
|
||||||
func (br *BaseRule) baseUpdate(category string, oldhostname string, hostname string, paramsJSON []byte) error {
|
func (br *BaseRule) baseUpdate(category string, oldhostname string, hostname string, paramsJSON []byte) error {
|
||||||
exists, err := db.HostnameExists(category, hostname)
|
exists, err := db.HostnameExists(category, oldhostname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error checking existence of hostname: %v", err.Error())
|
return fmt.Errorf("error checking existence of hostname: %v", err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue