mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
Services: Kea DHCP [new]: Kea DHCPv4 - move json file generation to a plugin hook, process feedback from d241cfda90
(ref: https://github.com/opnsense/core/pull/7361)
This commit is contained in:
parent
08ee9c0175
commit
80b65b0d5d
@ -34,10 +34,10 @@ function kea_services()
|
||||
$services[] = [
|
||||
'description' => gettext('KEA DHCPv4 server'),
|
||||
'pidfile' => '/var/run/kea/kea-dhcp4.kea-dhcp4.pid',
|
||||
'php' => [
|
||||
'restart' => ['kea_configure_do'],
|
||||
'start' => ['kea_configure_do'],
|
||||
'stop' => ['kea_service_stop'],
|
||||
'configd' => [
|
||||
'restart' => ['kea restart'],
|
||||
'start' => ['kea start'],
|
||||
'stop' => ['kea stop'],
|
||||
],
|
||||
'name' => 'kea-dhcpv4',
|
||||
];
|
||||
@ -48,9 +48,7 @@ function kea_services()
|
||||
function kea_configure()
|
||||
{
|
||||
return [
|
||||
'bootup' => ['kea_configure_do'],
|
||||
'kea_start' => ['kea_configure_do'],
|
||||
'kea_stop' => ['kea_service_stop']
|
||||
'kea_sync' => ['kea_configure_do']
|
||||
];
|
||||
}
|
||||
|
||||
@ -58,22 +56,13 @@ function kea_configure_do($verbose = false)
|
||||
{
|
||||
$keaDhcpv4 = new \OPNsense\Kea\KeaDhcpv4();
|
||||
if ($keaDhcpv4->isEnabled()) {
|
||||
service_log('Starting KEA DHCP...', $verbose);
|
||||
service_log('Sync KEA DHCP config...', $verbose);
|
||||
$keaDhcpv4->generateConfig();
|
||||
(new \OPNsense\Kea\KeaCtrlAgent())->generateConfig();
|
||||
if (isvalidpid('/var/run/kea/kea-dhcp4.kea-dhcp4.pid')) {
|
||||
mwexec("/usr/local/etc/rc.d/kea onestop", false);
|
||||
}
|
||||
mwexec_bg("/usr/local/etc/rc.d/kea onestart", false);
|
||||
service_log("done.\n", $verbose);
|
||||
}
|
||||
}
|
||||
|
||||
function kea_service_stop()
|
||||
{
|
||||
mwexec("/usr/local/etc/rc.d/kea onestop", false);
|
||||
}
|
||||
|
||||
function kea_syslog()
|
||||
{
|
||||
$logfacilities = [];
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
[stop]
|
||||
command:/usr/local/sbin/pluginctl -c kea_stop
|
||||
command:/usr/local/etc/rc.d/kea stop
|
||||
parameters:
|
||||
type:script
|
||||
message:stop kea daemon
|
||||
|
||||
[start]
|
||||
command:/usr/local/sbin/pluginctl -c kea_start
|
||||
command:/usr/local/etc/rc.d/kea start
|
||||
parameters:
|
||||
type:script
|
||||
message:start kea daemon
|
||||
|
||||
[restart]
|
||||
command:/usr/local/sbin/pluginctl -c kea_start
|
||||
command:/usr/local/etc/rc.d/kea restart
|
||||
parameters:
|
||||
type:script
|
||||
message:restart kea daemon
|
||||
|
||||
@ -1 +1,6 @@
|
||||
{% if not helpers.empty('OPNsense.Kea.dhcp4.general.interfaces') and not helpers.empty('OPNsense.Kea.dhcp4.general.enabled') %}
|
||||
kea_enable="YES"
|
||||
kea_setup="/usr/local/sbin/pluginctl -c kea_sync"
|
||||
{% else %}
|
||||
kea_enable="NO"
|
||||
{% endif %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user