xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
368 stars 172 forks source link

for windows, cmd will need input y/yes when copy post scripts? #5722

Open tomatome opened 6 years ago

tomatome commented 6 years ago

some config: 1, chdef -t site clustersite precreatemypostscripts=1 (no set, post cmd will hang) 2, copy some bat to winpostscripts. after nodeset action, $ip.cmd:

for /f "tokens=2 delims= " %%i in ('net use ^| find "install"') do set instdrv=%%i^M
%instdrv%\utils\windows\fixupunattend.vbs %instdrv%\autoinst\win7.xml x:\unattend.xml^M
%instdrv%\windows\x86_64\setup /unattend:x:\unattend.xml /noreboot^M
IF NOT EXIST %instdrv%\mypostscripts\mypostscript.win7 GOTO:SKIPPOST^M
IF NOT EXIST %instdrv%\winpostscripts\xcatwinpost.vbs GOTO:SKIPPOST^M
IF NOT EXIST %instdrv%\winpostscripts\runpost.vbs GOTO:SKIPPOST^M
mkdir c:\xcatpost^M
set NODENAME=win7^M
echo NODENAME=win7>>c:\xcatpost\xcatenv^M
copy %instdrv%\winpostscripts\* c:\xcatpost\^M
copy %instdrv%\mypostscripts\mypostscript.win7 c:\xcatpost\^M
:SKIPPOST^M
reg load HKLM\csystem c:\windows\system32\config\system^M
reg copy HKLM\system\CurrentControlSet\services\TCPIP6\parameters HKLM\csystem\ControlSet001\services\TCPIP6\parameters /f^M
reg copy HKLM\system\CurrentControlSet\services\TCPIP6\parameters HKLM\csystem\ControlSet002\services\TCPIP6\parameters /f^M
reg unload HKLM\csystem^M
If EXIST %instdrv%\winpostscripts GOTO wps^M
goto up^M
:wps^M
immarvin commented 6 years ago

hi @tomatome , interesting that you are using xCAT to manage windows servers. what xCAT version and Windows version are you using?

Maybe adding option /Y to copy command in /opt/xcat/lib/perl/xCAT_plugin/windows.pm will resolve this issue:

594         #crate c:\xcatpost
595         print $shandle "mkdir c:\\xcatpost\r\n";
596
597         #generate c:\xcatpost\xcatenv to pass env variables for later using
598         print $shandle "set NODENAME=$node\r\n";
599         print $shandle "echo NODENAME=$node>>c:\\xcatpost\\xcatenv\r\n";
600
601         #copy postscripts to c:\xcatpost
602         print $shandle "copy %instdrv%\\winpostscripts\\* c:\\xcatpost\\\r\n";
603         print $shandle "copy %instdrv%\\mypostscripts\\mypostscript.$node c:\\xcatpost\\\r\n";
604         print $shandle ":SKIPPOST\r\n";
605         #### test part
606         #print $shandle "start /max cmd\r\n";
607         #print $shandle "pause\r\n";
608
609         #print $shandle "i:\\postscripts\
610         print $shandle 'reg load HKLM\csystem c:\windows\system32\config\system' . "\r\n"; #copy installer DUID to system befo    re boot
611         print $shandle 'reg copy HKLM\system\CurrentControlSet\services\TCPIP6\parameters HKLM\csystem\ControlSet001\services\    TCPIP6\parameters /f' . "\r\n";
612         print $shandle 'reg copy HKLM\system\CurrentControlSet\services\TCPIP6\parameters HKLM\csystem\ControlSet002\services\    TCPIP6\parameters /f' . "\r\n";
613         print $shandle 'reg unload HKLM\csystem' . "\r\n";
614         print $shandle "If EXIST %instdrv%\\winpostscripts GOTO wps\r\n";
615         print $shandle "goto up\r\n"

windows is no longer officially supported in recent xCAT release and we do not have the environment to verify , would you please create a PR and post the test result on this? thanks

tomatome commented 6 years ago

xcat version: 2.14.2 I add to windows.pm "goto up" before "print $shandle ":SKIPPOST\r\n";" , it's ok. I am not sure if this is a problem with my use or a bug?