Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[service] More precise service control #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class dnsmasq (
Hash $configs_hash = {},
Hash $hosts_hash = {},
Hash $dhcp_hosts_hash = {},
String $package_ensure = 'installed',
Boolean $service_control = true,
Boolean $purge_config_dir = false,
Hash $configs_hash = {},
Hash $hosts_hash = {},
Hash $dhcp_hosts_hash = {},
String $package_ensure = 'installed',
Boolean $service_control = true,
Enum['running', 'stopped'] $service_ensure = 'running',
Boolean $service_enable = true,
Boolean $purge_config_dir = false,
) {
include dnsmasq::params

Expand All @@ -14,6 +16,8 @@

class { 'dnsmasq::service':
service_control => $service_control,
service_ensure => $service_ensure,
service_enable => $server_enable,
subscribe => Class['dnsmasq::install', 'dnsmasq::config'],
}

Expand Down
8 changes: 5 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class dnsmasq::service (
Variant[String, Boolean] $service_control = $dnsmasq::params::service_control,
Variant[String, Boolean] $service_control = $dnsmasq::params::service_control,
Enum['running', 'stopped'] $service_ensure = 'running',
Boolean $service_enable = true,
) {
# validate type and convert string to boolean if necessary
if $service_control =~ String {
Expand All @@ -9,8 +11,8 @@
}
if $service_control_real == true {
service { $dnsmasq::params::service_name:
ensure => 'running',
enable => true,
ensure => $service_ensure,
enable => $service_enable,
hasrestart => true,
hasstatus => true,
}
Expand Down