aboutsummaryrefslogtreecommitdiffstats
path: root/AdminPanel/Hosts/GHosts.pm
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo.pasotti@gmail.com>2014-01-25 15:30:44 +0100
committerMatteo Pasotti <matteo.pasotti@gmail.com>2014-01-25 15:30:44 +0100
commit5febc9fdfaeb56c8db55795986db7dfa27470bab (patch)
treefd42f930b4e8ffc1c366daec793c5860601dd091 /AdminPanel/Hosts/GHosts.pm
parent9c3601469aac8b540d30a0de0c742c85f0d9c5f2 (diff)
downloadmanatools-5febc9fdfaeb56c8db55795986db7dfa27470bab.tar
manatools-5febc9fdfaeb56c8db55795986db7dfa27470bab.tar.gz
manatools-5febc9fdfaeb56c8db55795986db7dfa27470bab.tar.bz2
manatools-5febc9fdfaeb56c8db55795986db7dfa27470bab.tar.xz
manatools-5febc9fdfaeb56c8db55795986db7dfa27470bab.zip
- fixed host aliases issue (undefined aliases where causing warnings and crashes)
Diffstat (limited to 'AdminPanel/Hosts/GHosts.pm')
-rw-r--r--AdminPanel/Hosts/GHosts.pm16
1 files changed, 13 insertions, 3 deletions
diff --git a/AdminPanel/Hosts/GHosts.pm b/AdminPanel/Hosts/GHosts.pm
index fcf95982..97ad6b8a 100644
--- a/AdminPanel/Hosts/GHosts.pm
+++ b/AdminPanel/Hosts/GHosts.pm
@@ -148,10 +148,16 @@ sub _manipulateHostDialog {
}
elsif($widget == $okButton) {
my $res = undef;
+ my @hosts_toadd;
+ push @hosts_toadd, $textHostName->value();
+ if(trim($textHostAlias->value()) ne ""){
+ push @hosts_toadd, $textHostAlias->value();
+ }
+ print "@hosts_toadd\n";
if($boolEdit == 0){
- $res = $self->cfgHosts->_insertHost($textIPAddress->value(),[$textHostName->value(), $textHostAlias->value()]);
+ $res = $self->cfgHosts->_insertHost($textIPAddress->value(),[@hosts_toadd]);
}else{
- $res = $self->cfgHosts->_modifyHost($textIPAddress->value(),[$textHostName->value(), $textHostAlias->value()]);
+ $res = $self->cfgHosts->_modifyHost($textIPAddress->value(),[@hosts_toadd]);
}
$res = $self->cfgHosts->_writeHosts();
print "Write result: $res\n";
@@ -289,7 +295,11 @@ sub manageHostsDialog {
}
elsif ($widget == $edtButton) {
my $tblItem = yui::toYTableItem($self->table->selectedItem());
- $self->_edtHostDialog($tblItem->cell(0)->label(),$tblItem->cell(1)->label(),$tblItem->cell(2)->label());
+ if($tblItem->cellCount() >= 3){
+ $self->_edtHostDialog($tblItem->cell(0)->label(),$tblItem->cell(1)->label(),$tblItem->cell(2)->label());
+ }else{
+ $self->_edtHostDialog($tblItem->cell(0)->label(),$tblItem->cell(1)->label(),"");
+ }
$self->setupTable();
}
elsif ($widget == $remButton) {