Skip to content

Commit

Permalink
Merge pull request #106 from EvanKrall/umask
Browse files Browse the repository at this point in the history
Allow setting of the umask for the consul daemon.
  • Loading branch information
solarkennedy committed Apr 14, 2015
2 parents 5cd1d5a + a8486bc commit e500563
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
$watches = {},
$checks = {},
$acls = {},
$umask = '0022',
) inherits consul::params {

validate_bool($purge_config_dir)
Expand Down
2 changes: 1 addition & 1 deletion templates/consul.debian.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ do_start()
mkrundir
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid $USER --background --make-pidfile --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid $USER --background --make-pidfile -- \
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid $USER --background --make-pidfile <%= scope.lookupvar('consul::umask') %> -- \
$DAEMON_ARGS \
|| return 2

Expand Down
1 change: 1 addition & 0 deletions templates/consul.launchd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<key>Label</key> <string>io.consul.daemon</string>
<key>UserName</key> <string><%= scope.lookupvar('consul::user') %></string>
<key>GroupName</key> <string><%= scope.lookupvar('consul::group') %></string>
<key>Umask</key> <string><%= scope.lookupvar('consul::umask') %></string>
<% if scope.lookupvar('consul::service_enable') %>
<key>Disabled</key> <false/>
<% else %>
Expand Down
1 change: 1 addition & 0 deletions templates/consul.sles.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ case "$1" in
echo -n "Starting consul "
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
umask <%= scope.lookupvar('consul::umask') %>
startproc $CONSUL_BIN agent -config-dir "$CONFIG_DIR" <%= scope.lookupvar('consul::extra_options') %> >> "$LOG_FILE"

# Remember status and be verbose
Expand Down
1 change: 1 addition & 0 deletions templates/consul.systemd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ After=basic.target network.target
[Service]
User=<%= scope.lookupvar('consul::user') %>
Group=<%= scope.lookupvar('consul::group') %>
Umask=<%= scope.lookupvar('consul::umask') %>
ExecStart=<%= scope.lookupvar('consul::bin_dir') %>/consul agent \
-config-dir <%= scope.lookupvar('consul::config_dir') %> <%= scope.lookupvar('consul::extra_options') %>
ExecReload=/bin/kill -HUP $MAINPID
Expand Down
2 changes: 1 addition & 1 deletion templates/consul.sysv.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ start() {
mkrundir
[ -f $PID_FILE ] && rm $PID_FILE
daemon --user=<%= scope.lookupvar('consul::user') %> \
--pidfile="$PID_FILE" \
--pidfile="$PID_FILE" --umask=<%= scope.lookupvar('consul::umask') %> \
"$CONSUL" agent -pid-file "${PID_FILE}" -config-dir "$CONFIG" <%= scope.lookupvar('consul::extra_options') %> >> "$LOG_FILE" &
retcode=$?
touch /var/lock/subsys/consul
Expand Down
1 change: 1 addition & 0 deletions templates/consul.upstart.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ stop on runlevel [06]
env CONSUL=<%= scope.lookupvar('consul::bin_dir') %>/consul
env CONFIG=<%= scope.lookupvar('consul::config_dir') %>

umask <%= scope.lookupvar('consul::umask') %>

script
# read settings like GOMAXPROCS from "/etc/default/consul", if available.
Expand Down

0 comments on commit e500563

Please sign in to comment.