Support for have_nodeip_dns_col setting (closes #14)

This commit is contained in:
Oliver Gorwits
2012-08-27 20:37:07 +01:00
parent fb950311bb
commit f41a5a58ce
3 changed files with 16 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
* Icon to copy Navbar search text to Device Search Options field (closes #11)
* Typeahead on the main navbar search (for devices only)
* Support for have_nodeip_dns_col setting (closes #14)
[ENHANCEMENTS]

View File

@@ -47,13 +47,16 @@ Calling the C<dns()> accessor will either return the content of that field if
the field is configured and installed, or else perform a live DNS lookup on
the IP field within the record (returning the first PTR, or undef).
To enable this feature, set the C<HAVE_NODEIP_DNS_COL> environment variable to
a true value. In the Netdisco web app you can activate the column using the
C<have_nodeip_dns_col> application setting, instead.
=cut
# XXX uncomment the following two lines if you have a "dns" column XXX
# XXX in your node_ip table which caches the host's name XXX
#__PACKAGE__->add_column("dns" =>
# { data_type => "text", is_nullable => 1, accessor => undef });
# XXX ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XXX
if ($ENV{HAVE_NODEIP_DNS_COL}) {
__PACKAGE__->add_column("dns" =>
{ data_type => "text", is_nullable => 1, accessor => undef });
}
# some customize their node_ip table to have a dns column which
# is the cached record at the time of discovery

View File

@@ -2,7 +2,13 @@ package Netdisco::Web;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
use Dancer::Plugin::DBIC;
BEGIN {
if (setting('have_nodeip_dns_col')) {
$ENV{HAVE_NODEIP_DNS_COL} = 1;
}
use Dancer::Plugin::DBIC;
}
use Socket6 (); # to ensure dependency is met
use HTML::Entities (); # to ensure dependency is met