On 03.04.2015 [02:17:17 +0000], Britt Houser (bhouser) wrote:
I'm working on a RHEL7 docker container with cobbler in it. I
have setup
cobbler in this container to manage dhcpd.
It seems like you're not configuring the containers correctly. Cobbler
should run in one container and dhcpd should run in another, right?
Dare I ask why you're doing this? :)
One hurdle with this setup is that a cobbler sync needs to restart
dhcpd, but a docker container has no systemd. So what I've done to
work around this is to edit
/usr/lib/python2.7/site-packages/cobbler/modules/sync_post_restart_services
.py and change the dhcp_restart_command to call a simple shell
script:
--
#!/bin/sh
#dhcpd writes its pid to /var/run/dhcpd.pid
#kill the PID in the file, if the file exists
if [ -f "/var/run/dhcpd.pid" ]
then
kill `cat /var/run/dhcpd.pid`
fi
#Start again using command line from /usr/lib/systemd/system/dhcpd.service
/usr/sbin/dhcpd -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd
--
I do realize I'm not really supposed to have more than one process in a
container. But if I put dhcpd in its own container, the problem would just
be even harder b/c now cobbler in its container needs to restart another
container.
No, it just needs to restart (reload) that process. Meaning dhcpd needs
either graceful reload, or, as you said, you need to be able to restart
the DHCP process itself. Containerization isn't free :)
So I took the easier route and put them in the same container.
So in this implementation, it would be useful if I could specify a custom
dhcp_restart_command in /etc/cobbler/settings. Would that be a change the
community would be interested in accepting?
I think the right way is to provide another option to the
[dhcp]
module = manage_isc
section of configuration, which is something like
[dhcp]
module = manage_local
And configure that appropriately? I've done that, for instance, for
having a local version of authentication.
-Nish