return aRecord from ldap search
This commit is contained in:
4
main.go
4
main.go
@ -96,7 +96,7 @@ func main() {
|
||||
fmt.Sprintf("zoneName=%s,cn=dns,%s", ldap.EscapeFilter(domain), ldap.EscapeFilter(ldap_search_base)),
|
||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||
fmt.Sprintf("(relativeDomainName=%s)", ldap.EscapeFilter(host)),
|
||||
[]string{"dn"},
|
||||
[]string{"dn","aRecord"},
|
||||
nil,
|
||||
)
|
||||
|
||||
@ -108,7 +108,7 @@ func main() {
|
||||
if len(sr.Entries) != 1 {
|
||||
log.Fatalf("Host does not exist or too many entries returned (%+v)", len(sr.Entries))
|
||||
}
|
||||
log.Printf("Record found for %s.%s", host, domain)
|
||||
log.Printf("Record found for %s.%s: %+v", host, domain, sr.Entries[0])
|
||||
newIp := getip2()
|
||||
if sr.Entries[0].GetAttributeValue("aRecord") == newIp {
|
||||
log.Println("New IP is same as old IP, exiting gracefully.")
|
||||
|
||||
Reference in New Issue
Block a user