Update 01_delete_dns_record.js

This commit is contained in:
John Bowdre 2022-07-11 09:05:14 -05:00 committed by GitHub
parent 653b66b042
commit 81162ccb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -6,12 +6,12 @@
var hostname = inputProperties.resourceNames[0];
var dnsDomain = inputProperties.customProperties.domain;
var deleted = false;
if (dnsHost_supportedDomains.indexOf(dnsDomain) >= 0) {
if (dnsHost.supportedDomains.indexOf(dnsDomain) >= 0) {
System.log("Attempting to remove DNS record for " + hostname + "...");
var sshSession = new SSHSession(dnsHost_sshHost, dnsHost_sshUser);
System.debug("Connecting to " + dnsHost_sshHost + "...");
sshSession.connectWithPassword(dnsHost_sshPass);
for each (var dnsServer in dnsHost_dnsServers) {
var sshSession = new SSHSession(dnsHost.sshHost, dnsHost.sshUser);
System.debug("Connecting to " + dnsHost.sshHost + "...");
sshSession.connectWithPassword(dnsHost.sshPass);
for each (var dnsServer in dnsHost.dnsServers) {
if (deleted == false) {
System.debug("Using DNS Server " + dnsServer + "...");
var sshCommand = 'Remove-DnsServerResourceRecord -ComputerName ' + dnsServer + ' -Name ' + hostname + ' -ZoneName ' + dnsDomain + ' -RRType A -Force';
@ -29,4 +29,4 @@ if (dnsHost_supportedDomains.indexOf(dnsDomain) >= 0) {
}
} else {
System.log("No need to remove DNS records.");
}
}