mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-30 13:58:15 +00:00
parse, change and display single change failed message
This commit is contained in:
@@ -35,6 +35,11 @@ object RecordSetChangeHandler extends TransactionProvider {
|
||||
private implicit val cs: ContextShift[IO] =
|
||||
IO.contextShift(scala.concurrent.ExecutionContext.global)
|
||||
|
||||
private val outOfSyncFailureMessage: String = "This record set is out of sync with the DNS backend; sync this zone before attempting to update this record set."
|
||||
private val incompatibleRecordFailureMessage: String = "Incompatible record in DNS."
|
||||
private val syncZoneMessage: String = "This record set is out of sync with the DNS backend. Sync this zone before attempting to update this record set."
|
||||
private val recordConflictMessage: String = "Conflict due to the record being added having the same name as an NS record in the same zone."
|
||||
|
||||
final case class Requeue(change: RecordSetChange) extends Throwable
|
||||
|
||||
def apply(
|
||||
@@ -167,7 +172,7 @@ object RecordSetChangeHandler extends TransactionProvider {
|
||||
if (existingRecords.isEmpty) ReadyToApply(change)
|
||||
else if (isDnsMatch(existingRecords, change.recordSet, change.zone.name))
|
||||
AlreadyApplied(change)
|
||||
else Failure(change, "Incompatible record in DNS.")
|
||||
else Failure(change, incompatibleRecordFailureMessage)
|
||||
|
||||
case RecordSetChangeType.Update =>
|
||||
if (isDnsMatch(existingRecords, change.recordSet, change.zone.name))
|
||||
@@ -181,8 +186,7 @@ object RecordSetChangeHandler extends TransactionProvider {
|
||||
else
|
||||
Failure(
|
||||
change,
|
||||
"This record set is out of sync with the DNS backend; " +
|
||||
"sync this zone before attempting to update this record set."
|
||||
outOfSyncFailureMessage
|
||||
)
|
||||
}
|
||||
|
||||
@@ -388,11 +392,25 @@ object RecordSetChangeHandler extends TransactionProvider {
|
||||
case AlreadyApplied(_) => Completed(change.successful)
|
||||
case ReadyToApply(_) => Validated(change)
|
||||
case Failure(_, message) =>
|
||||
Completed(
|
||||
change.failed(
|
||||
s"""Failed validating update to DNS for change "${change.id}": "${change.recordSet.name}": """ + message
|
||||
if(message == outOfSyncFailureMessage || message == incompatibleRecordFailureMessage){
|
||||
Completed(
|
||||
change.failed(
|
||||
syncZoneMessage
|
||||
)
|
||||
)
|
||||
)
|
||||
} else if (message == "referral") {
|
||||
Completed(
|
||||
change.failed(
|
||||
recordConflictMessage
|
||||
)
|
||||
)
|
||||
} else {
|
||||
Completed(
|
||||
change.failed(
|
||||
s"""Failed validating update to DNS for change "${change.id}": "${change.recordSet.name}": """ + message
|
||||
)
|
||||
)
|
||||
}
|
||||
case Retry(_) => Retrying(change)
|
||||
}
|
||||
|
||||
|
@@ -1593,8 +1593,7 @@ def test_update_fails_for_unapplied_unsynced_record_change(shared_zone_test_cont
|
||||
]
|
||||
update_response = client.update_recordset(update_rs, status=202)
|
||||
response = client.wait_until_recordset_change_status(update_response, "Failed")
|
||||
assert_that(response["systemMessage"], is_(f"Failed validating update to DNS for change \"{response['id']}\": \"{a_rs['name']}\": "
|
||||
f"This record set is out of sync with the DNS backend; sync this zone before attempting to update this record set."))
|
||||
assert_that(response["systemMessage"], is_(f"This record set is out of sync with the DNS backend. Sync this zone before attempting to update this record set."))
|
||||
finally:
|
||||
try:
|
||||
delete_result = client.delete_recordset(zone["id"], create_rs["id"], status=202)
|
||||
|
@@ -194,6 +194,9 @@
|
||||
&& change.status =='Complete'">
|
||||
ℹ️ {{change.systemMessage}}
|
||||
</div>
|
||||
<div ng-if="(change.systemMessage != '' && change.systemMessage != undefined) && change.status =='Failed'">
|
||||
{{change.systemMessage}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
Reference in New Issue
Block a user