diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-08 06:03:36 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-08 06:03:36 +0000 |
commit | 0925fb0cd9b7d370a57247b00f402d33f6f0d78b (patch) | |
tree | 7687cce7d2c104be7acc6ec496690916b38445a0 | |
parent | 333842bd860aee58cb8e7712c9e24f812b53107e (diff) | |
download | puppet-0925fb0cd9b7d370a57247b00f402d33f6f0d78b.tar.gz puppet-0925fb0cd9b7d370a57247b00f402d33f6f0d78b.tar.xz puppet-0925fb0cd9b7d370a57247b00f402d33f6f0d78b.zip |
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
-rw-r--r-- | lib/puppet/transaction.rb | 5 | ||||
-rwxr-xr-x | lib/puppet/type/user.rb | 25 | ||||
-rw-r--r-- | test/lib/puppettest/testcase.rb | 5 | ||||
-rwxr-xr-x | test/ral/types/user.rb | 11 |
4 files changed, 16 insertions, 30 deletions
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 182534de7..fed2348a9 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -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 diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index fa0344931..ae62e577d 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -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 diff --git a/test/lib/puppettest/testcase.rb b/test/lib/puppettest/testcase.rb index be3ee6c6a..cfedeee26 100644 --- a/test/lib/puppettest/testcase.rb +++ b/test/lib/puppettest/testcase.rb @@ -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| diff --git a/test/ral/types/user.rb b/test/ral/types/user.rb index 641d9cd82..8af6b5d48 100755 --- a/test/ral/types/user.rb +++ b/test/ral/types/user.rb @@ -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 |