ISG::HostList - Parse ISGTC list of hosts
use ISG::HostList;
my $parser = ISG::HostList->new;
my $cfg = $parser->parse('/path/to/host.list');
defined $cfg or die "ERROR: $parser->{err}\n";
The host.list configuration file is a file used by ISGTC tools to find out configuration information about hosts. It is our authoritative information source about hosts.
This module does parse this file and returns the information as a hash-reference where the key is the host-name (first column of the tables) and the value is another hash where the key is the attribute-name and the value the value for that attribute of that host.
Create a parser object.
Parse file (##ISGTC_MAGIC_SYSCONFDIR##/host.list if not specified) and return the hash of the parsed file.
The configuration is made of two parts that can be repeated and mixed: variables definitions and host tables.
Variables definition lines have the syntax VARIABLE = VALUE. They
pre-define attributes for the hosts defined in the host tables. * in the
value will be replaced by the value with the same name in the following tables.
Host tables start with a Host table definition line which defines the
columns of the table and has the syntax + COL1 COL2 ... COLN, where COL1,
COL2, etc. are attribute names.
Host tables follow the host-table-definition line and has the syntax COL1
COL2 ... COLN, where COL1, COL2, etc. are the values of the attributes
defined in the host-table-definition.
Empty lines and everything after a # will be ignored. A \ at the
end-of-line means line continued on next line.
IP = 192.168.* DEF_GW = 192.168.* ETHER = 08:00:20:* NETMASK = 255.255.255.192
##### EE.ETHZ.CH #####
DOMAIN = ee.ethz.ch
+ HOST IP ETHER DEF_GW OS ROOT ARCH tardis 2.199 aa:bb:cc 2.193 sol26 / sun4u jobis 2.220 12:34:56 2.193 sol8 / sun4u drwho 2.215 fc:cf:fc 2.193 sol8 / sun4u
##### MAVT.ETHZ.CH #####
DOMAIN = mavt.ethz.ch NETMASK = 255.255.255.192
+ HOST IP ETHER DEF_GW OS ROOT ARCH lkt-bird 4.226 aa:83:83 4.129 sol8 / sun4u lkt-monk 4.227 bb:8a:8a 4.129 sol8 / sun4u
drwho => {
ARCH => 'sun4u'
DEF_GW => '192.168.2.193'
DOMAIN => 'ee.ethz.ch'
ETHER => '08:00:20:fc:cf:fc'
HOST => 'drwho'
IP => '192.168.2.215'
NETMASK => '255.255.255.192'
OS => 'sol8'
ROOT => '/'
}
jobis => {
ARCH => 'sun4u'
DEF_GW => '192.168.2.193'
DOMAIN => 'ee.ethz.ch'
ETHER => '08:00:20:12:34:56'
HOST => 'jobis'
IP => '192.168.2.220'
NETMASK => '255.255.255.192'
OS => 'sol8'
ROOT => '/'
}
lkt-bird => {
ARCH => 'sun4u'
DEF_GW => '192.168.4.129'
DOMAIN => 'mavt.ethz.ch'
ETHER => '08:00:20:aa:83:83'
HOST => 'lkt-bird'
IP => '192.168.4.226'
NETMASK => '255.255.255.192'
OS => 'sol8'
ROOT => '/'
}
[...]
Copyright (c) 2001 by ETH Zurich. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
David Schweikert <dws@ee.ethz.ch>
2001-10-08 ds 1.0 first version