summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-15 16:48:39 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-15 16:48:39 +0000
commitfc98ab07f3a05cec529e75d53fbd5f234df2a519 (patch)
tree6bab3cd2cdf38413caea8229a24e470e0a63bef2
parent5dcf3036b9e88084176a597f85e75c4a9e491c58 (diff)
downloadpuppet-fc98ab07f3a05cec529e75d53fbd5f234df2a519.tar.gz
puppet-fc98ab07f3a05cec529e75d53fbd5f234df2a519.tar.xz
puppet-fc98ab07f3a05cec529e75d53fbd5f234df2a519.zip
Fixing #100. I just added a bit of a hack to configuration parsing -- if a group is specified in a section that matches the name of the process, then it is assumed to be the group that the process should run as. The problem is that we are reusing the term "group" here for both the run-group and the file-group. Oh well.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1036 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/config.rb8
-rwxr-xr-xtest/other/config.rb21
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb
index ff1494ea8..4fb2840b7 100644
--- a/lib/puppet/config.rb
+++ b/lib/puppet/config.rb
@@ -222,6 +222,14 @@ class Config
values[section] = {}
end
values[section][var.to_s] = value
+
+ # Do some annoying skullduggery here. This is so that
+ # the group can be set in the config file. The problem
+ # is that we're using the word 'group' twice, which is
+ # confusing.
+ if var == :group and section == Puppet.name and @config.include?(:group)
+ @config[:group].value = value
+ end
next
end
diff --git a/test/other/config.rb b/test/other/config.rb
index b404f93ad..62a308040 100755
--- a/test/other/config.rb
+++ b/test/other/config.rb
@@ -496,6 +496,27 @@ yay = /a/path
assert(! Puppet.type(:file)["/dev/testing"], "Created dev file")
end
+
+ def test_groupsetting
+ cfile = tempfile()
+
+ group = "yayness"
+
+ File.open(cfile, "w") do |f|
+ f.puts "[#{Puppet.name}]
+ group = #{group}
+ "
+ end
+
+ config = mkconfig
+ config.setdefaults(Puppet.name, :group => ["puppet", "a group"])
+
+ assert_nothing_raised {
+ config.parse(cfile)
+ }
+
+ assert_equal(group, config[:group], "Group did not take")
+ end
end
# $Id$