/** * Load updatenode page * * @param tgtNodes * Targets to run updatenode against * @return Nothing */ function loadUpdatenodePage(tgtNodes) { // Get OS images $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'tabdump', tgt : '', args : 'osimage', msg : '' }, success : setOSImageCookies }); // Get node OS (AIX, rh*, centos*, fedora*, or sles*) var osHash = new Object(); var nodes = tgtNodes.split(','); for (var i in nodes) { var os = getNodeAttr(nodes[i], 'os'); var osBase = os.match(/[a-zA-Z]+/); if (osBase) { nodes[osBase] = 1; } } // Get nodes tab var tab = getNodesTab(); // Generate new tab ID var inst = 0; var newTabId = 'updatenodeTab' + inst; while ($('#' + newTabId).length) { // If one already exists, generate another one inst = inst + 1; newTabId = 'updatenodeTab' + inst; } // Create updatenode form var updatenodeForm = $('
'); // Create status bar var statBarId = 'updatenodeStatusBar' + inst; var statusBar = createStatusBar(statBarId); statusBar.hide(); updatenodeForm.append(statusBar); // Create loader var loader = createLoader('updatenodeLoader'); statusBar.append(loader); // Create info bar var infoBar = createInfoBar('Update nodes in an xCAT environment'); updatenodeForm.append(infoBar); // Create target node or group input var target = $('
'); updatenodeForm.append(target); // Create options var optsDIV = $('
'); var optsLabel = $(''); var optsList = $(''); optsDIV.append(optsLabel); optsDIV.append(optsList); updatenodeForm.append(optsDIV); // Create update all software checkbox (AIX) if (osHash['AIX']) { var updateAllChkBox = $(''); var updateAllOpt = $('
  • '); optsList.append(updateAllOpt); updateAllOpt.append(updateAllChkBox); updateAllOpt.append('Install or update all software contained in the source directory'); var allSwScrDirectory = $('
  • '); allSwScrDirectory.hide(); optsList.append(allSwScrDirectory); // Show alternate source directory when checked updateAllChkBox.bind('click', function(event) { if ($(this).is(':checked')) { allSwScrDirectory.show(); } else { allSwScrDirectory.hide(); } }); } // Create update software checkbox var updateChkBox = $(''); var updateOpt = $('
  • '); optsList.append(updateOpt); updateOpt.append(updateChkBox); updateOpt.append('Update existing software'); // Create source directory input var scrDirectory = $('
  • '); scrDirectory.hide(); optsList.append(scrDirectory); // Create other packages input var otherPkgs = $('
  • '); otherPkgs.hide(); optsList.append(otherPkgs); // Create RPM flags input var rpmFlags = $('
  • '); rpmFlags.hide(); optsList.append(rpmFlags); // Create installp flags input var installPFlags = $('
  • '); installPFlags.hide(); optsList.append(installPFlags); // Create emgr flags input var emgrFlags = $('
  • '); emgrFlags.hide(); optsList.append(emgrFlags); // Show alternate source directory when checked updateChkBox.bind('click', function(event) { if ($(this).is(':checked')) { scrDirectory.show(); otherPkgs.show(); if (osHash['AIX']) { rpmFlags.show(); installPFlags.show(); emgrFlags.show(); } } else { scrDirectory.hide(); otherPkgs.hide(); if (osHash['AIX']) { rpmFlags.hide(); installPFlags.hide(); emgrFlags.hide(); } } }); // Create postscripts input var postChkBox = $(''); var postOpt = $('
  • '); optsList.append(postOpt); postOpt.append(postChkBox); postOpt.append('Run postscripts'); var postscripts = $('
  • '); postscripts.hide(); optsList.append(postscripts); // Show alternate source directory when checked postChkBox.bind('click', function(event) { if ($(this).is(':checked')) { postscripts.show(); } else { postscripts.hide(); } }); optsList.append('
  • Distribute and synchronize files
  • '); optsList.append('
  • Update the ssh keys and host keys for the service nodes and compute nodes
  • '); // Create update OS checkbox if (!osHash['AIX']) { var osChkBox = $(''); var osOpt = $('
  • '); optsList.append(osOpt); osOpt.append(osChkBox); osOpt.append('Update the operating system'); var os = $('
  • ').hide(); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function(){ var tmp = $.cookie('OSVers'); if (tmp) { // Turn on auto complete $(this).autocomplete(tmp.split(',')); } }); os.append(osLabel); os.append(osInput); optsList.append(os); // Show alternate source directory when checked osChkBox.bind('click', function(event) { if ($(this).is(':checked')) { os.show(); } else { os.hide(); } }); } /** * Ok */ var okBtn = createButton('Ok'); okBtn.bind('click', function(event) { var ready = true; // Generate arguments var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked"); var optStr = ''; var opt; for ( var i = 0; i < chkBoxes.length; i++) { opt = chkBoxes.eq(i).attr('name'); optStr += '-' + opt; // If update all software is checked if (opt == 'S') { var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val(); if (srcDir) { optStr += ';-d ' + srcDir; } } // If update software is checked if (opt == 'S') { // Get source directory var srcDir = $('#' + newTabId + ' input[name=srcDirectory]').val(); if (srcDir) { optStr += ';-d;' + srcDir; } // Get otherpkgs var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val(); if (otherpkgs) { optStr += ';otherpkgs=' + otherpkgs; } // Get rpm_flags var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val(); if (rpm_flags) { optStr += ';rpm_flags=' + rpm_flags; } // Get installp_flags var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val(); if (installp_flags) { optStr += ';installp_flags=' + installp_flags; } // Get emgr_flags var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val(); if (emgr_flags) { optStr += ';emgr_flags=' + emgr_flags; } } // If postscripts is checked if (opt == 'P') { // Get postscripts optStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val(); } // If operating system is checked if (opt == 'o') { // Get the OS optStr += ';' + $('#' + newTabId + ' input[name=os]').val(); } // Append ; to end of string if (i < (chkBoxes.length - 1)) { optStr += ';'; } } // If no inputs are empty if (ready) { // Get nodes var tgts = $('#' + newTabId + ' input[name=target]').val(); // Disable Ok button $(this).unbind(event); $(this).css( { 'background-color' : '#F2F2F2', 'color' : '#424242' }); /** * (1) Boot to network */ $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'updatenode', tgt : tgts, args : optStr, msg : 'out=' + statBarId + ';cmd=updatenode;tgt=' + tgts }, success : updateStatusBar }); // Show status bar statusBar.show(); } else { alert('You are missing some values'); } }); updatenodeForm.append(okBtn); // Append to discover tab tab.add(newTabId, 'Updatenode', updatenodeForm, true); // Select new tab tab.select(newTabId); }