Adding validation to the user type to confirm that the

group list does not contain any commas. This seems to be
a common problem.
This commit is contained in:
Luke Kanies 2008-04-08 11:19:15 -05:00
Родитель 87f801bc17
Коммит 80f8b80eac
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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