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
diff --git a/src/maasserver/static/js/angular/factories/domains.js b/src/maasserver/static/js/angular/factories/domains.js
index 5a9537f..355c917 100644
--- a/src/maasserver/static/js/angular/factories/domains.js
+++ b/src/maasserver/static/js/angular/factories/domains.js
@@ -71,7 +71,7 @@ angular.module('MAAS').factory(
71 if(record.rrtype === 'A' || record.rrtype === 'AAAA') {71 if(record.rrtype === 'A' || record.rrtype === 'AAAA') {
72 record.ip_addresses = record.rrdata.split(/[ ,]+/);72 record.ip_addresses = record.rrdata.split(/[ ,]+/);
73 return RegionConnection.callMethod(73 return RegionConnection.callMethod(
74 "domain.delete_address_record", record);74 "domain.delete_dnsresource", record);
75 } else {75 } else {
76 return RegionConnection.callMethod(76 return RegionConnection.callMethod(
77 "domain.delete_dnsdata", record);77 "domain.delete_dnsdata", record);
diff --git a/src/maasserver/static/js/angular/factories/tests/test_domains.js b/src/maasserver/static/js/angular/factories/tests/test_domains.js
index 920c12c..8c5823c 100644
--- a/src/maasserver/static/js/angular/factories/tests/test_domains.js
+++ b/src/maasserver/static/js/angular/factories/tests/test_domains.js
@@ -135,6 +135,41 @@ describe("DomainsManager", function() {
135 });135 });
136 });136 });
137137
138 describe("deleteDNSRecord", function() {
139 it("calls delete_dnsresource for A record", function() {
140 spyOn(RegionConnection, "callMethod");
141 var record = {
142 'rrtype': 'A',
143 'rrdata': '192.168.0.1'
144 };
145 DomainsManager.deleteDNSRecord(record);
146 expect(RegionConnection.callMethod).toHaveBeenCalledWith(
147 "domain.delete_dnsresource", record);
148 });
149
150 it("calls delete_dnsresource for AAAA record", function() {
151 spyOn(RegionConnection, "callMethod");
152 var record = {
153 'rrtype': 'AAAA',
154 'rrdata': '2001:db8::1, 10.0.0.1 127.0.0.1'
155 };
156 DomainsManager.deleteDNSRecord(record);
157 expect(RegionConnection.callMethod).toHaveBeenCalledWith(
158 "domain.delete_dnsresource", record);
159 });
160
161 it("calls update_dnsdata for other types", function() {
162 spyOn(RegionConnection, "callMethod");
163 var record = {
164 'rrtype': 'SRV'
165 };
166 DomainsManager.deleteDNSRecord(record);
167 expect(RegionConnection.callMethod).toHaveBeenCalledWith(
168 "domain.delete_dnsdata", record);
169 });
170
171 });
172
138 describe("getDomainByName", function() {173 describe("getDomainByName", function() {
139 it("returns null when no domains", function() {174 it("returns null when no domains", function() {
140 expect(DomainsManager.getDomainByName('meh')).toBe(null);175 expect(DomainsManager.getDomainByName('meh')).toBe(null);

Subscribers

People subscribed via source and target branches