Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set gid of the watched process if setting the user.

  • Loading branch information...
commit a6b2e665489789b291303ce7e38c15f17c066236 1 parent d801e82
@rkistner rkistner authored
View
6 lib/foreman_god/god_config.rb
@@ -89,6 +89,11 @@ def log_path
@options[:log] || 'log'
end
+ def group_name
+ gid = Etc.getpwnam(user_name).gid
+ Etc.getgrgid(gid).name
+ end
+
def wrap_command(cmd)
if user_name
@@ -140,6 +145,7 @@ def watch_process(name, process, n)
if user_name && (Etc.getlogin != user_name)
# Only set the uid if the user is different from the current user
w.uid = user_name
+ w.gid = group_name
end
# w.gid = ?
View
2  lib/foreman_god/version.rb
@@ -1,3 +1,3 @@
module ForemanGod
- VERSION = "0.0.3"
+ VERSION = "0.0.4"
end
View
3  spec/god_config_spec.rb
@@ -28,7 +28,7 @@
watch.log.should == '/dev/null'
watch.uid.should == nil # The user name is the same as the current user
-
+ watch.gid.should == nil
end
it "should log if log is specified" do
@@ -79,6 +79,7 @@
# We cannot easily test watch.uid in a single-user setup
pending "Test watch.uid"
#watch.uid.should == user
+ #watch.gid.should == ?
end
end

0 comments on commit a6b2e66

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