fix: check if record already exists
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
02d24104e1
commit
7f1d9eeaec
|
@ -100,6 +100,19 @@ Which means you can then deploy an app against "myapp.foo.com" successfully.
|
||||||
record.Priority = priority
|
record.Priority = priority
|
||||||
}
|
}
|
||||||
|
|
||||||
|
records, err := provider.GetRecords(c.Context, zone)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, existingRecord := range records {
|
||||||
|
if existingRecord.Type == record.Type &&
|
||||||
|
existingRecord.Name == record.Name &&
|
||||||
|
existingRecord.Value == record.Value {
|
||||||
|
logrus.Fatal("provider library reports that this record already exists?")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
createdRecords, err := provider.SetRecords(
|
createdRecords, err := provider.SetRecords(
|
||||||
c.Context,
|
c.Context,
|
||||||
zone,
|
zone,
|
||||||
|
@ -128,9 +141,10 @@ Which means you can then deploy an app against "myapp.foo.com" successfully.
|
||||||
strconv.Itoa(createdRecord.Priority),
|
strconv.Itoa(createdRecord.Priority),
|
||||||
})
|
})
|
||||||
|
|
||||||
table.SetCaption(true, "record created")
|
|
||||||
table.Render()
|
table.Render()
|
||||||
|
|
||||||
|
logrus.Info("record created")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue