Used profile name to get directory entry instead of group name.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11293 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-12-24 14:57:13 +00:00
parent 9cd6ae2db6
commit d5bbb7c2fa
2 changed files with 19 additions and 15 deletions

View File

@ -2307,37 +2307,41 @@ function createZProvisionNew(inst) {
// Get tab ID
var thisTabId = $(this).parents('.ui-tabs-panel').attr('id');
// Get objects for HCP, user ID, and group
// Get objects for HCP, user ID, and OS
var hcp = $('#' + thisTabId + ' input[name=hcp]');
var userId = $('#' + thisTabId + ' input[name=userId]');
var group = $('#' + thisTabId + ' input[name=group]');
var os = $('#' + thisTabId + ' input[name=os]');
// Get default user entry when clicked
if ($(this).attr('checked')) {
if (!hcp.val() || !group.val() || !userId.val()) {
if (!hcp.val() || !os.val() || !userId.val()) {
// Show warning message
var warn = createWarnBar('Please specify the hardware control point, group, and user ID before checking this box');
var warn = createWarnBar('Please specify the hardware control point, operating system, and user ID before checking this box');
warn.prependTo($(this).parents('.form'));
// Highlight empty fields
jQuery.each([hcp, group, userId], function() {
jQuery.each([hcp, os, userId], function() {
if (!$(this).val()) {
$(this).css('border', 'solid #FF0000 1px');
}
});
} else {
// Un-highlight empty fields
jQuery.each([hcp, group, userId], function() {
jQuery.each([hcp, os, userId], function() {
$(this).css('border', 'solid #BDBDBD 1px');
});
// Get profile name
var tmp = os.val().split('-');
var profile = tmp[3];
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'getdefaultuserentry;' + hcp.val() + ';' + group.val(),
args : 'getdefaultuserentry;' + hcp.val() + ';' + profile,
msg : thisTabId
},
@ -2355,7 +2359,7 @@ function createZProvisionNew(inst) {
$('#' + thisTabId + ' textarea:visible').val('');
// Un-highlight empty fields
jQuery.each([hcp, group, userId], function() {
jQuery.each([hcp, os, userId], function() {
$(this).css('border', 'solid #BDBDBD 1px');
});
}

View File

@ -2177,17 +2177,17 @@ sub web_getdefaultuserentry {
# Get hardware control point
my $hcp = $request->{arg}->[1];
my $group = $request->{arg}->[2];
my $profile = $request->{arg}->[2];
if (!$group) {
$group = 'default';
if (!$profile) {
$profile = 'default';
}
my $entry;
if (!(`ssh $hcp "test -e /opt/zhcp/conf/$group.direct && echo 'File exists'"`)) {
$entry = `ssh $hcp "cat /opt/zhcp/conf/default.direct"`;
if (!(`ssh $hcp "test -e /opt/zhcp/conf/profiles/$profile.direct && echo 'File exists'"`)) {
$entry = `ssh $hcp "cat /opt/zhcp/conf/profiles/default.direct"`;
} else {
$entry = `ssh $hcp "cat /opt/zhcp/conf/$group.direct"`;
$entry = `ssh $hcp "cat /opt/zhcp/conf/profiles/$profile.direct"`;
}
$callback->( { data => $entry } );