summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-08 11:19:15 -0500
committerLuke Kanies <luke@madstop.com>2008-04-08 11:19:15 -0500
commit80f8b80eacfa80bfd7b7d4f348838592161ed97a (patch)
tree1e02e4d952166f982c789e44243733b47b3b84a6
parent87f801bc17af22659b37fece2a0c4efdcdcc1e57 (diff)
downloadpuppet-80f8b80eacfa80bfd7b7d4f348838592161ed97a.tar.gz
puppet-80f8b80eacfa80bfd7b7d4f348838592161ed97a.tar.xz
puppet-80f8b80eacfa80bfd7b7d4f348838592161ed97a.zip
Adding validation to the user type to confirm that the
group list does not contain any commas. This seems to be a common problem.
-rwxr-xr-xlib/puppet/type/user.rb3
-rwxr-xr-xtest/ral/type/user.rb6
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 48e35f2c8..71507d172 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -220,6 +220,9 @@ module Puppet
if value =~ /^\d+$/
raise ArgumentError, "Group names must be provided, not numbers"
end
+ if value.include?(",")
+ raise ArgumentError, "Group names must be provided as an array, not a comma-separated list"
+ end
end
end
diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb
index b280acfed..87d5b6075 100755
--- a/test/ral/type/user.rb
+++ b/test/ral/type/user.rb
@@ -362,6 +362,12 @@ class TestUser < Test::Unit::TestCase
user.delete(:groups)
end
+ def test_groups_list_must_not_contain_commas
+ assert_raise(Puppet::Error) do
+ Puppet::Type.type(:user).create :name => "luke", :groups => "root,adm"
+ end
+ end
+
def test_autorequire
file = tempfile()
comp = nil