diff --git a/modules/api/src/main/scala/vinyldns/api/engine/RecordSetChangeHandler.scala b/modules/api/src/main/scala/vinyldns/api/engine/RecordSetChangeHandler.scala index c29061851..d135f347a 100644 --- a/modules/api/src/main/scala/vinyldns/api/engine/RecordSetChangeHandler.scala +++ b/modules/api/src/main/scala/vinyldns/api/engine/RecordSetChangeHandler.scala @@ -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) } diff --git a/modules/api/src/test/functional/tests/recordsets/update_recordset_test.py b/modules/api/src/test/functional/tests/recordsets/update_recordset_test.py index 6a4ef58cf..823dcecba 100644 --- a/modules/api/src/test/functional/tests/recordsets/update_recordset_test.py +++ b/modules/api/src/test/functional/tests/recordsets/update_recordset_test.py @@ -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) diff --git a/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html b/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html index 5437d4949..956fa95f7 100644 --- a/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html +++ b/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html @@ -194,6 +194,9 @@ && change.status =='Complete'"> ℹ️ {{change.systemMessage}} +