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:
Родитель
87f801bc17
Коммит
80f8b80eac
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче