Subject: | Groups in dhcpd.conf |
Date: | Fri, 30 Sep 2011 19:32:10 +0200 |
To: | jhthorsen [...] cpan.org, bug-net-isc-dhcpd [...] rt.cpan.org |
From: | Michael Rath <itsrath [...] itsm.uni-stuttgart.de> |
Hi Jan Henning,
I am about to write a script that makes the generation of a dhcpd.conf
file easier. Therefore I'd like to parse the file, add new host entries
and save it back with a script.
I gladly found your Perl class Net::ISC::DHCPd:Config that should help
me a lot. Unfortunately I first found no way to retain host groups.
There seemed to be a class for it, but it doesn't show up as a member of
Config.
Without nearly any knowledge of Perl ;-) I tried inserting the line
Net::ISC::DHCPd::Config::Group
under
__PACKAGE__->create_children(qw/
in line 107 in the file
"/usr/lib/perl5/site_perl/5.8.8/Net/ISC/DHCPd/Config.pm" and wow! the
groups are there...
So you probably should patch that?!?
But there are some problems remaining:
The pools are lost and so are the keys and the classes.
I send you a copy of the first part of my dhcpd.conf. If you try it with
------------------------------------------------
#!/usr/bin/perl
use Net::ISC::DHCPd::Config;
my $config = Net::ISC::DHCPd::Config->new(
file => '/etc/dhcpd3/dhcpd.conf',
);
# parse the config
$config->parse;
# parsing includes are lazy
for my $include ($config->includes) {
$include->parse;
}
print $config->generate;
------------------------------------------------
and compare the output with the original you will see what the problems
are...
Regards
Michael
Message body is not shown because sender requested not to inline it.