Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Set gid of the watched process if setting the user.

  • Loading branch information...
commit a6b2e665489789b291303ce7e38c15f17c066236 1 parent d801e82
Ralf Kistner rkistner authored
6 lib/foreman_god/god_config.rb
@@ -89,6 +89,11 @@ def log_path
89 89 @options[:log] || 'log'
90 90 end
91 91
  92 + def group_name
  93 + gid = Etc.getpwnam(user_name).gid
  94 + Etc.getgrgid(gid).name
  95 + end
  96 +
92 97
93 98 def wrap_command(cmd)
94 99 if user_name
@@ -140,6 +145,7 @@ def watch_process(name, process, n)
140 145 if user_name && (Etc.getlogin != user_name)
141 146 # Only set the uid if the user is different from the current user
142 147 w.uid = user_name
  148 + w.gid = group_name
143 149 end
144 150
145 151 # w.gid = ?
2  lib/foreman_god/version.rb
... ... @@ -1,3 +1,3 @@
1 1 module ForemanGod
2   - VERSION = "0.0.3"
  2 + VERSION = "0.0.4"
3 3 end
3  spec/god_config_spec.rb
@@ -28,7 +28,7 @@
28 28 watch.log.should == '/dev/null'
29 29
30 30 watch.uid.should == nil # The user name is the same as the current user
31   -
  31 + watch.gid.should == nil
32 32 end
33 33
34 34 it "should log if log is specified" do
@@ -79,6 +79,7 @@
79 79 # We cannot easily test watch.uid in a single-user setup
80 80 pending "Test watch.uid"
81 81 #watch.uid.should == user
  82 + #watch.gid.should == ?
82 83 end
83 84 end
84 85

0 comments on commit a6b2e66

Please sign in to comment.
Something went wrong with that request. Please try again.