Actions
Bug #23353
closedIssues with default directory for included DHCP files
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
DHCP
Target version:
-
Description
In case of ISC DHCP integration enabled:
If DHCP config file is read during proxy startup, all files referenced in dhcpd.conf using include statement are loaded for inspection.
This is leading to issues, if those are not specified with an absolute path, but just with a simple filename.
Example:
[root@foreman dns]# cat /etc/dhcp/dhcpd.conf
include "omapi.key";
(--- remaining part of file snipped ---)
It seems as if those files are searched in the root directory instead of the directory where the dhcp config file itself is located.
The following code fixed the issue for me:
patch -p0 /usr/share/foreman-proxy/modules/dhcp_common/isc/configuration_parser.rb << '@EOF' *** dada 2018-04-10 04:35:16.461982185 +0200 --- configuration_parser.rb 2018-04-10 04:30:57.872176905 +0200 *************** *** 382,392 **** --- 382,394 ---- end def parse_file(a_path) + a_path = @@config_path + '/' + a_path if File.dirname(a_path) == '.' File.open(a_path, 'r') {|f| conf.parse!(f.read, a_path)} end # returns all_subnets, all_hosts, root_group def subnets_hosts_and_leases(conf_as_string, filename) + @@config_path = File.dirname(filename) parsed = conf.parse!(conf_as_string, filename) start_visiting_parse_tree_nodes(parsed) end @EOF
Actions