Skip to content

Commit da2b759

Browse files
committed
Handle special YES/NO values for service flags
Certain rc.conf(8) variables configurable via rcctl(8) do not correspond to services; en/disabled ones report YES/NO as flags value, which is an implementation detail and thus cannot work as daemon flags: ``` $ rcctl get multicast multicast=NO $ rcctl get pf flags YES # rcctl set pf flags foo rcctl: "pf" is a special variable, cannot "set flags" ``` Actual services may have default flags set in their `/etc/rc.d/*` scripts, but also report NO unless they are enabled: ``` $ rcctl get rarpd status ; echo $? 1 $ rcctl get rarpd flags NO $ rcctl getdef rarpd flags -a ``` Turn those into `nil` for puppet-resource(8) to yield proper flags: ``` $ puppet resource service pf service { 'pf': ensure => 'stopped', enable => 'true', - flags => 'YES', provider => 'openbsd', } $ puppet resource service rarpd service { 'rarpd': ensure => 'stopped', enable => 'false', - flags => 'NO', provider => 'openbsd', } ```
1 parent 0a4c63e commit da2b759

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/puppet/provider/service/openbsd.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,12 @@ def running?
5757
true if output =~ /\(ok\)/
5858
end
5959

60-
# Uses the wrapper to prevent failure when the service is not running;
61-
# rcctl(8) return non-zero in that case.
60+
# Disabled services always have 'NO' flags.
6261
def flags
6362
output = execute([command(:rcctl), "get", @resource[:name], "flags"],
6463
:failonfail => false, :combine => false, :squelch => false).chomp
6564
debug("Flags are: \"#{output}\"")
66-
output
65+
output unless %w[YES NO].include?(output)
6766
end
6867

6968
def flags=(value)

0 commit comments

Comments
 (0)