🐛 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:
Florian Beisel 2024-01-18 00:11:39 +01:00
parent ce4d469466
commit f0118ab8ea
Signed by: florian
GPG Key ID: 79ECA2E54996FF4D
1 changed files with 1 additions and 1 deletions

View File

@ -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 {
exists, err := db.HostnameExists(category, hostname)
exists, err := db.HostnameExists(category, oldhostname)
if err != nil {
return fmt.Errorf("error checking existence of hostname: %v", err.Error())
}