Adding some more testing on the @should values for :groups on users, and fixing a bug that often made :groups think it was out of sync.

git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2267 980ebf18-57e1-0310-9a29-db15c13687c0
This commit is contained in:
luke 2007-03-08 06:03:36 +00:00
Родитель 333842bd86
Коммит 0925fb0cd9
4 изменённых файлов: 16 добавлений и 30 удалений

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

@ -69,11 +69,8 @@ class Transaction
# And then return
return []
end
changes = [changes] unless changes.is_a?(Array)
unless changes.is_a? Array
changes = [changes]
end
changes = [changes] unless changes.is_a?(Array)
if changes.length > 0
@resourcemetrics[:out_of_sync] += 1

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

@ -6,27 +6,6 @@ module Puppet
newtype(:user) do
newproperty(:ensure) do
newvalue(:present, :event => :user_created) do
# Verify that they have provided everything necessary, if we
# are trying to manage the user
# if @parent.managed?
# @parent.class.properties.each { |property|
# next if propertyobj = @parent.property(property.name)
# next if property.name == :ensure
#
# unless property.autogen? or property.isoptional?
# if property.method_defined?(:autogen)
# @parent[property.name] = :auto
# else
# @parent.fail "Users require a value for %s" %
# property.name
# end
# end
# }
#
# #if @properties.empty?
# # @parent[:comment] = @parent[:name]
# #end
# end
provider.create
end
@ -223,10 +202,10 @@ module Puppet
def insync?
unless defined? @should and @should
return false
return true
end
unless defined? @is and @is
return false
return true
end
tmp = @is
if @is.is_a? Array

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

@ -1,11 +1,12 @@
#!/usr/bin/env ruby
#
# Created by Luke A. Kanies on 2006-11-24.
# Copyright (c) 2006. All rights reserved.
# Created by Luke A. Kanies on 2007-03-05.
# Copyright (c) 2007. All rights reserved.
require 'puppettest'
class PuppetTest::TestCase < Test::Unit::TestCase
include PuppetTest
def self.confine(hash)
@confines ||= {}
hash.each do |message, result|

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

@ -448,11 +448,20 @@ class TestUser < Test::Unit::TestCase
# Testing #455
def test_autorequire_with_no_group_should
user = Puppet::Type.type(:user).create(:name => "user", :check => :all)
user = Puppet::Type.type(:user).create(:name => "yaytest", :check => :all)
assert_nothing_raised do
user.autorequire
end
user[:ensure] = :absent
assert_nothing_raised do
user.evaluate
end
assert(user.send(:property, :groups).insync?,
"Groups state considered out of sync with no :should value")
end
end