Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
refactor / add config_change_restart option
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Birkett committed Jul 18, 2017
1 parent ffb38c0 commit 8503103
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
41 changes: 25 additions & 16 deletions manifests/instance.pp
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Define: dropwizard::instance
define dropwizard::instance (
$ensure = 'present',
$version = '0.0.1-SNAPSHOT',
$package = undef,
$jar_file = undef,
$sysconfig = {},
$user = $::dropwizard::run_user,
$group = $::dropwizard::run_group,
$mode = $::dropwizard::config_mode,
$base_path = $::dropwizard::base_path,
$sysconfig_path = $::dropwizard::sysconfig_path,
$config_path = $::dropwizard::config_path,
$config_test = false,
$config_files = [],
$config_hash = {
$ensure = 'present',
$version = '0.0.1-SNAPSHOT',
$package = undef,
$jar_file = undef,
$sysconfig = {},
$user = $::dropwizard::run_user,
$group = $::dropwizard::run_group,
$mode = $::dropwizard::config_mode,
$base_path = $::dropwizard::base_path,
$sysconfig_path = $::dropwizard::sysconfig_path,
$config_path = $::dropwizard::config_path,
$config_test = false,
$config_change_restart = true,
$config_files = [],
$config_hash = {
'server' => {
'type' => 'simple',
'appContextPath' => '/application',
Expand Down Expand Up @@ -47,9 +48,17 @@
default => 'present',
}

#Set validate_cmd
# Set validate_cmd
if $config_test {
$validate_cmd = "su - ${user} -c \"/bin/java -jar ${jar_file} check %\""
} else {
$validate_cmd = undef
}

if $config_change_restart {
$notify_service = Service["dropwizard_${name}"]
} else {
$notify_service = undef
}

file { "${sysconfig_path}/dropwizard_${name}":
Expand All @@ -69,7 +78,7 @@
content => inline_template('<%= @config_hash.to_yaml.gsub("---\n", "") %>'),
require => File[$config_path,"${sysconfig_path}/dropwizard_${name}"],
validate_cmd => $validate_cmd,
notify => Service["dropwizard_${name}"],
notify => $notify_service,
}

# Assign default jar
Expand Down
1 change: 0 additions & 1 deletion templates/service/dropwizard.systemd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ RestartSec=30s

[Install]
WantedBy=multi-user.target

0 comments on commit 8503103

Please sign in to comment.