diff options
author | Luke Kanies <luke@madstop.com> | 2008-04-08 11:19:15 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-04-08 11:19:15 -0500 |
commit | 80f8b80eacfa80bfd7b7d4f348838592161ed97a (patch) | |
tree | 1e02e4d952166f982c789e44243733b47b3b84a6 | |
parent | 87f801bc17af22659b37fece2a0c4efdcdcc1e57 (diff) | |
download | puppet-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-x | lib/puppet/type/user.rb | 3 | ||||
-rwxr-xr-x | test/ral/type/user.rb | 6 |
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 |