-
-
Notifications
You must be signed in to change notification settings - Fork 880
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1414 from ekohl/simplify-service
Simplify service class
- Loading branch information
Showing
3 changed files
with
11 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,14 @@ | ||
# Class: nginx::service | ||
# | ||
# This module manages NGINX service management and server rebuild | ||
# | ||
# Parameters: | ||
# | ||
# There are no default parameters for this class. | ||
# | ||
# Actions: | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
# This class file is not called directly | ||
class nginx::service ( | ||
$service_restart = $nginx::service_restart, | ||
$service_ensure = $nginx::service_ensure, | ||
$service_enable = $nginx::service_enable, | ||
$service_name = $nginx::service_name, | ||
$service_flags = $nginx::service_flags, | ||
$service_manage = $nginx::service_manage, | ||
) { | ||
# @summary Manage NGINX service management | ||
# @api private | ||
class nginx::service { | ||
assert_private() | ||
|
||
if $service_manage { | ||
case $facts['os']['name'] { | ||
'OpenBSD': { | ||
service { $service_name: | ||
ensure => $service_ensure, | ||
enable => $service_enable, | ||
flags => $service_flags, | ||
hasstatus => true, | ||
hasrestart => true, | ||
} | ||
} | ||
default: { | ||
service { $service_name: | ||
ensure => $service_ensure, | ||
enable => $service_enable, | ||
hasstatus => true, | ||
hasrestart => true, | ||
} | ||
} | ||
} | ||
} | ||
|
||
# Allow overriding of 'restart' of Service resource; not used by default | ||
if $service_restart { | ||
Service[$service_name] { | ||
restart => $service_restart, | ||
if $nginx::service_manage { | ||
service { $nginx::service_name: | ||
ensure => $nginx::service_ensure, | ||
enable => $nginx::service_enable, | ||
flags => $nginx::service_flags, | ||
restart => $nginx::service_restart, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters