From e5755dbc64cd4ae9e1d2a5d3e5cc91a421bc6021 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 25 Mar 2013 20:02:04 +0000 Subject: [PATCH] Add directive to support alternate DNS server for windows deployments if DHCP is not to be trusted git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15661 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 6b747a32c..703f6ce95 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -219,6 +219,7 @@ sub subvars { $inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg; $inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg; $inc =~ s/#WINADJOIN#/windows_join_data()/eg; + $inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg; $inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg; $inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg; $inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg; @@ -333,6 +334,35 @@ sub windows_account_data { $useraccountxml.="\r\n\r\nAdministrators\r\nDomain Admins\r\n\r\n".$domain."\r\n\r\n\r\n"; return $useraccountxml; } +sub windows_dns_cfg { + my $domain; + my $doment; + my $noderesent; + my $noderestab = xCAT::Table->new("noderes",-create=>0); + unless ($noderestab) { return ""; } + $noderesent = $noderestab->getNodeAttribs($node,['nameservers'],prefetchcache=>1); + unless ($noderesent and $noderesent->{nameservers}) { return ""; } + my $nameservers = $noderesent->{nameservers}; + + my $domaintab = xCAT::Table->new('domain',-create=>0); + if ($domaintab) { + $doment = $domaintab->getNodeAttribs($node,['authdomain'],prefetchcache=>1); + } + if ($doment and $doment->{authdomain}) { + $domain = $doment->{authdomain}; + } else { + $domain = $::XCATSITEVALS{domain}; + } + my $componentxml = ''."\r\n$domain\r\n". + "\r\n==PRINIC==\r\n\r\n"; + my $idx=1; + foreach (split /,/,$nameservers) { + $componentxml.="$_\r\n"; + $idx+=1; + } + $componentxml .= "\r\n\r\n\r\n"; + return $componentxml; +} #this will examine table data, decide *if* a Microsoft-Windows-UnattendedJoin is warranted #there are two variants in how to proceed: #-Hide domain administrator from node: xCAT will use MACHINEPASSWORD to do joining to AD. Currently requires SSL be enabled on DC. Samba 4 TODO