We are also using cobbler in a docker container, and we use supervisord for process management in CentOS 6.6. What we did is, we changed the Sys V init script of dhcpd service to use supervisorctl. *service dhcpd start *is an standard command and since your container is always customised to your specific requirements, you can always modify the startup scripts.
On Mon, Apr 6, 2015 at 11:47 PM, Nishanth Aravamudan < nacc@linux.vnet.ibm.com> wrote:
On 06.04.2015 [08:58:35 +0200], J?rgen Maas wrote:
Hi Nish,
I agree and i'd be happy to take any patches to clean stuff up.
Not yet tested, but this should work...
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 7a41ee2..8734151 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -212,27 +212,7 @@ class CobblerSync:
if self.settings.manage_dhcp: self.write_dhcp()
if which_dhcp_module == "manage_isc":
service_name = utils.dhcp_service_name(self.api)
if restart_dhcp != "0":
rc = utils.subprocess_call(self.logger, "dhcpd -t
-q", shell=True)
if rc != 0:
error_msg = "dhcpd -t failed"
self.logger.error(error_msg)
raise CX(error_msg)
service_restart = "service %s restart" % service_name
rc = utils.subprocess_call(self.logger,
service_restart, shell=True)
if rc != 0:
error_msg = "%s failed" % service_name
self.logger.error(error_msg)
raise CX(error_msg)
elif which_dhcp_module == "manage_dnsmasq":
if restart_dhcp != "0":
rc = utils.subprocess_call(self.logger, "service
dnsmasq restart")
if rc != 0:
error_msg = "service dnsmasq restart failed"
self.logger.error(error_msg)
raise CX(error_msg)
self.dhcp.sync_dhcp()
def clean_link_cache(self): for dirtree in [os.path.join(self.bootloc, 'images'),
self.settings.webdir]: diff --git a/cobbler/modules/manage_dnsmasq.py b/cobbler/modules/manage_dnsmasq.py index a87365c..7ec24e6 100644 --- a/cobbler/modules/manage_dnsmasq.py +++ b/cobbler/modules/manage_dnsmasq.py @@ -191,6 +191,14 @@ class DnsmasqManager: # already taken care of by the regen_hosts() pass
- def sync_dhcp(self):
restart_dhcp = str(self.settings.restart_dhcp).lower()
if restart_dhcp != "0":
rc = utils.subprocess_call(self.logger, "service dnsmasq
restart")
if rc != 0:
error_msg = "service dnsmasq restart failed"
self.logger.error(error_msg)
raise CX(error_msg)
def get_manager(collection_mgr, logger): return DnsmasqManager(collection_mgr, logger) diff --git a/cobbler/modules/manage_isc.py b/cobbler/modules/manage_isc.py index 6dabd32..d0a8102 100644 --- a/cobbler/modules/manage_isc.py +++ b/cobbler/modules/manage_isc.py @@ -188,6 +188,21 @@ class IscManager: def regen_ethers(self): pass # ISC/BIND do not use this
- def sync_dhcp(self):
restart_dhcp = str(self.settings.restart_dhcp).lower()
service_name = utils.dhcp_service_name(self.api)
if restart_dhcp != "0":
rc = utils.subprocess_call(self.logger, "dhcpd -t -q",
shell=True)
if rc != 0:
error_msg = "dhcpd -t failed"
self.logger.error(error_msg)
raise CX(error_msg)
service_restart = "service %s restart" % service_name
rc = utils.subprocess_call(self.logger, service_restart,
shell=True)
if rc != 0:
error_msg = "%s failed" % service_name
self.logger.error(error_msg)
raise CX(error_msg)
def get_manager(collection_mgr, logger): return IscManager(collection_mgr, logger)
cobbler-devel mailing list cobbler-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler-devel