The Netinfo and DirectoryService providers can now create user and group simultaneously.

This required selectively using property#sync if a 'should' value
is present, so that the user's gid property can do the conversion
if necessary.

Signed-off-by: Luke Kanies <luke@madstop.com>
This commit is contained in:
Luke Kanies 2008-09-30 17:50:31 -05:00
Родитель 4c998fe67d
Коммит 2480654aa0
2 изменённых файлов: 24 добавлений и 5 удалений

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

@ -206,9 +206,18 @@ class DirectoryService < Puppet::Provider::NameService
if ensure_value == :present
@resource.class.validproperties.each do |name|
next if name == :ensure
next unless val = @resource.should(name) || autogen(name)
# JJM: This calls the method.
self.send(name.to_s + "=", val)
# LAK: We use property.sync here rather than directly calling
# the settor method because the properties might do some kind
# of conversion. In particular, the user gid property might
# have a string and need to convert it to a number
if @resource.should(name)
@resource.property(name).sync
elsif value = autogen(name)
self.send(name.to_s + "=", value)
else
next
end
end
end
end

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

@ -138,8 +138,18 @@ class NetInfo < Puppet::Provider::NameService
if arg == :present
@resource.class.validproperties.each do |name|
next if name == :ensure
next unless val = @resource.should(name) || autogen(name)
self.send(name.to_s + "=", val)
# LAK: We use property.sync here rather than directly calling
# the settor method because the properties might do some kind
# of conversion. In particular, the user gid property might
# have a string and need to convert it to a number
if @resource.should(name)
@resource.property(name).sync
elsif value = autogen(name)
self.send(name.to_s + "=", value)
else
next
end
end
end
end