mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-09-01 06:45:21 +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] =
|
private implicit val cs: ContextShift[IO] =
|
||||||
IO.contextShift(scala.concurrent.ExecutionContext.global)
|
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
|
final case class Requeue(change: RecordSetChange) extends Throwable
|
||||||
|
|
||||||
def apply(
|
def apply(
|
||||||
@@ -167,7 +172,7 @@ object RecordSetChangeHandler extends TransactionProvider {
|
|||||||
if (existingRecords.isEmpty) ReadyToApply(change)
|
if (existingRecords.isEmpty) ReadyToApply(change)
|
||||||
else if (isDnsMatch(existingRecords, change.recordSet, change.zone.name))
|
else if (isDnsMatch(existingRecords, change.recordSet, change.zone.name))
|
||||||
AlreadyApplied(change)
|
AlreadyApplied(change)
|
||||||
else Failure(change, "Incompatible record in DNS.")
|
else Failure(change, incompatibleRecordFailureMessage)
|
||||||
|
|
||||||
case RecordSetChangeType.Update =>
|
case RecordSetChangeType.Update =>
|
||||||
if (isDnsMatch(existingRecords, change.recordSet, change.zone.name))
|
if (isDnsMatch(existingRecords, change.recordSet, change.zone.name))
|
||||||
@@ -181,8 +186,7 @@ object RecordSetChangeHandler extends TransactionProvider {
|
|||||||
else
|
else
|
||||||
Failure(
|
Failure(
|
||||||
change,
|
change,
|
||||||
"This record set is out of sync with the DNS backend; " +
|
outOfSyncFailureMessage
|
||||||
"sync this zone before attempting to update this record set."
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,11 +392,25 @@ object RecordSetChangeHandler extends TransactionProvider {
|
|||||||
case AlreadyApplied(_) => Completed(change.successful)
|
case AlreadyApplied(_) => Completed(change.successful)
|
||||||
case ReadyToApply(_) => Validated(change)
|
case ReadyToApply(_) => Validated(change)
|
||||||
case Failure(_, message) =>
|
case Failure(_, message) =>
|
||||||
|
if(message == outOfSyncFailureMessage || message == incompatibleRecordFailureMessage){
|
||||||
|
Completed(
|
||||||
|
change.failed(
|
||||||
|
syncZoneMessage
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else if (message == "referral") {
|
||||||
|
Completed(
|
||||||
|
change.failed(
|
||||||
|
recordConflictMessage
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
Completed(
|
Completed(
|
||||||
change.failed(
|
change.failed(
|
||||||
s"""Failed validating update to DNS for change "${change.id}": "${change.recordSet.name}": """ + message
|
s"""Failed validating update to DNS for change "${change.id}": "${change.recordSet.name}": """ + message
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
case Retry(_) => Retrying(change)
|
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)
|
update_response = client.update_recordset(update_rs, status=202)
|
||||||
response = client.wait_until_recordset_change_status(update_response, "Failed")
|
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']}\": "
|
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."))
|
||||||
f"This record set is out of sync with the DNS backend; sync this zone before attempting to update this record set."))
|
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
delete_result = client.delete_recordset(zone["id"], create_rs["id"], status=202)
|
delete_result = client.delete_recordset(zone["id"], create_rs["id"], status=202)
|
||||||
|
@@ -194,6 +194,9 @@
|
|||||||
&& change.status =='Complete'">
|
&& change.status =='Complete'">
|
||||||
ℹ️ {{change.systemMessage}}
|
ℹ️ {{change.systemMessage}}
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-if="(change.systemMessage != '' && change.systemMessage != undefined) && change.status =='Failed'">
|
||||||
|
{{change.systemMessage}}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Reference in New Issue
Block a user