Compare commits

..

2 commits

Author SHA1 Message Date
John Bowdre
7ee71ee5ec
Update 03_create_dns_record.js 2022-07-11 09:05:50 -05:00
John Bowdre
81162ccb49
Update 01_delete_dns_record.js 2022-07-11 09:05:14 -05:00
2 changed files with 8 additions and 8 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.");
}
}

View file

@ -10,7 +10,7 @@ var ipAddress = inputProperties.addresses[0];
var created = false;
if (staticDns == "true" && dnsHost.supportedDomains.indexOf(dnsDomain) >= 0) {
System.log("Attempting to create DNS record for " + hostname + "." + ipAddress + "...");
var sshSession = new SSHSession(dnsHost.sshHost, dnsHost_sshUser);
var sshSession = new SSHSession(dnsHost.sshHost, dnsHost.sshUser);
System.debug("Connecting to " + dnsHost.sshHost + "...");
sshSession.connectWithPassword(dnsHost.sshPass);
for each (dnsServer in dnsHost.dnsServers) {
@ -31,4 +31,4 @@ if (staticDns == "true" && dnsHost.supportedDomains.indexOf(dnsDomain) >= 0) {
}
} else {
System.log("Not trying to do DNS.");
}
}