Fix create records + exit loop on error + add bold to notification
This commit is contained in:
parent
50dcc9d994
commit
ccf6d1e8d0
1 changed files with 7 additions and 4 deletions
11
main.go
11
main.go
|
|
@ -190,7 +190,7 @@ func main() {
|
|||
})
|
||||
|
||||
pushoverMessages = append(pushoverMessages, fmt.Sprintf(
|
||||
"Action: update\nZone: %s\nRecord: %s\nType: %s\nValue: %s\nTTL: %d",
|
||||
"<b>Action:</b> update\n<b>Zone:</b> %s\n<b>Record:</b> %s\n<b>Type:</b> %s\n<b>Value:</b> %s\n<b>TTL:</b> %d",
|
||||
zone.Domain,
|
||||
record.Name,
|
||||
record.Type,
|
||||
|
|
@ -217,7 +217,7 @@ func main() {
|
|||
})
|
||||
|
||||
pushoverMessages = append(pushoverMessages, fmt.Sprintf(
|
||||
"Action: create\nZone: %s\nRecord: %s\nType: %s\nValue: %s\nTTL: %d",
|
||||
"<b>Action:</b> create\n<b>Zone:</b> %s\n<b>Record:</b> %s\n<b>Type:</b> %s\n<b>Value:</b> %s\n<b>TTL:</b> %d",
|
||||
zone.Domain,
|
||||
record.Name,
|
||||
record.Type,
|
||||
|
|
@ -254,7 +254,7 @@ func main() {
|
|||
})
|
||||
|
||||
pushoverMessages = append(pushoverMessages, fmt.Sprintf(
|
||||
"Action: delete\nZone: %s\nRecord: %s\nType: %s\nValue: %s\nTTL: %d",
|
||||
"<b>Action:</b> delete\n<b>Zone:</b> %s\n<b>Record:</b> %s\n<b>Type:</b> %s\n<b>Value:</b> %s\n<b>TTL:</b> %d",
|
||||
hZone.Name,
|
||||
hRecord.Name,
|
||||
hRecord.Type,
|
||||
|
|
@ -275,6 +275,7 @@ func main() {
|
|||
hetzner.DeleteRecord(&record)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Warn(
|
||||
|
|
@ -287,9 +288,10 @@ func main() {
|
|||
log.Info("Starting sync (step 2: create)", "dry_run", config.DryRun)
|
||||
for _, record := range recordsToCreate {
|
||||
if !config.DryRun {
|
||||
newRecord, err := hetzner.UpdateRecord(&record)
|
||||
newRecord, err := hetzner.CreateRecord(&record)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Warn(
|
||||
|
|
@ -305,6 +307,7 @@ func main() {
|
|||
newRecord, err := hetzner.UpdateRecord(&record)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Warn(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue