Merge ~ya-bo-ng/maas:remove-entire-dnsresource into maas:master

Proposed by Anthony Dillon
Status: Merged
Approved by: Anthony Dillon
Approved revision: cabef6771aa15eadaa5f136bf2a918574a2047e6
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ya-bo-ng/maas:remove-entire-dnsresource
Merge into: maas:master
Diff against target: 59 lines (+36/-1)
2 files modified
src/maasserver/static/js/angular/factories/domains.js (+1/-1)
src/maasserver/static/js/angular/factories/tests/test_domains.js (+35/-0)
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
MAAS Lander Approve
Steve Rydz (community) Approve
Review via email: mp+363836@code.launchpad.net

Commit message

LP: #1817674 - Completely remove the DNS resource when deleting from the UI

Description of the change

Remove the entire DNS resource when deleting via the UI instead of just the IP addresses.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b remove-entire-dnsresource lp:~ya-bo-ng/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 4697bb59439f83d036b29e82d1b16c1451b8b6b1

review: Approve
Revision history for this message
Steve Rydz (steverydz) wrote :

LGTM +1

review: Approve
Revision history for this message
Alberto Donato (ack) wrote :

change looks good but could you please also add a test for it?

Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Thanks Alberto, added a few tests for the deleteDNSRecord method.

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b remove-entire-dnsresource lp:~ya-bo-ng/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: cabef6771aa15eadaa5f136bf2a918574a2047e6

review: Approve
Revision history for this message
Alberto Donato (ack) wrote :

+1, thanks for the added tests

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/factories/domains.js b/src/maasserver/static/js/angular/factories/domains.js
2index 5a9537f..355c917 100644
3--- a/src/maasserver/static/js/angular/factories/domains.js
4+++ b/src/maasserver/static/js/angular/factories/domains.js
5@@ -71,7 +71,7 @@ angular.module('MAAS').factory(
6 if(record.rrtype === 'A' || record.rrtype === 'AAAA') {
7 record.ip_addresses = record.rrdata.split(/[ ,]+/);
8 return RegionConnection.callMethod(
9- "domain.delete_address_record", record);
10+ "domain.delete_dnsresource", record);
11 } else {
12 return RegionConnection.callMethod(
13 "domain.delete_dnsdata", record);
14diff --git a/src/maasserver/static/js/angular/factories/tests/test_domains.js b/src/maasserver/static/js/angular/factories/tests/test_domains.js
15index 920c12c..8c5823c 100644
16--- a/src/maasserver/static/js/angular/factories/tests/test_domains.js
17+++ b/src/maasserver/static/js/angular/factories/tests/test_domains.js
18@@ -135,6 +135,41 @@ describe("DomainsManager", function() {
19 });
20 });
21
22+ describe("deleteDNSRecord", function() {
23+ it("calls delete_dnsresource for A record", function() {
24+ spyOn(RegionConnection, "callMethod");
25+ var record = {
26+ 'rrtype': 'A',
27+ 'rrdata': '192.168.0.1'
28+ };
29+ DomainsManager.deleteDNSRecord(record);
30+ expect(RegionConnection.callMethod).toHaveBeenCalledWith(
31+ "domain.delete_dnsresource", record);
32+ });
33+
34+ it("calls delete_dnsresource for AAAA record", function() {
35+ spyOn(RegionConnection, "callMethod");
36+ var record = {
37+ 'rrtype': 'AAAA',
38+ 'rrdata': '2001:db8::1, 10.0.0.1 127.0.0.1'
39+ };
40+ DomainsManager.deleteDNSRecord(record);
41+ expect(RegionConnection.callMethod).toHaveBeenCalledWith(
42+ "domain.delete_dnsresource", record);
43+ });
44+
45+ it("calls update_dnsdata for other types", function() {
46+ spyOn(RegionConnection, "callMethod");
47+ var record = {
48+ 'rrtype': 'SRV'
49+ };
50+ DomainsManager.deleteDNSRecord(record);
51+ expect(RegionConnection.callMethod).toHaveBeenCalledWith(
52+ "domain.delete_dnsdata", record);
53+ });
54+
55+ });
56+
57 describe("getDomainByName", function() {
58 it("returns null when no domains", function() {
59 expect(DomainsManager.getDomainByName('meh')).toBe(null);

Subscribers

People subscribed via source and target branches