diff options
| author | Luke Kanies <luke@madstop.com> | 2008-12-17 18:29:58 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-12-18 11:10:25 -0600 |
| commit | e4ba3db1963081eacc2aef3d865f777b427ef23c (patch) | |
| tree | 55a4aa8cdde262880a8affb6cbd4470d49c10c55 /test | |
| parent | b6db54585177f277b1e06bebd4d925d5c272b610 (diff) | |
Deprecating the Puppet::Type.create.
This method is no longer necessary; you can use the
normal 'new' class method.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'test')
39 files changed, 261 insertions, 261 deletions
diff --git a/test/lib/puppettest/support/resources.rb b/test/lib/puppettest/support/resources.rb index 045579302..a2beee98d 100755 --- a/test/lib/puppettest/support/resources.rb +++ b/test/lib/puppettest/support/resources.rb @@ -5,7 +5,7 @@ module PuppetTest::Support::Resources def tree_resource(name) - Puppet::Type.type(:file).create :title => name, :path => "/tmp/#{name}", :mode => 0755 + Puppet::Type.type(:file).new :title => name, :path => "/tmp/#{name}", :mode => 0755 end def tree_container(name) diff --git a/test/network/client/master.rb b/test/network/client/master.rb index e27b7a3a2..ee6a2c6ab 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -269,7 +269,7 @@ end user = nonrootuser() group = nonrootgroup() - chowner = Puppet::Type.type(:file).create :path => dir, + chowner = Puppet::Type.type(:file).new :path => dir, :owner => user.name, :group => group.name, :recurse => true assert_apply(chowner) chowner.remove diff --git a/test/other/events.rb b/test/other/events.rb index 6e6d52024..c4c2a53e6 100755 --- a/test/other/events.rb +++ b/test/other/events.rb @@ -11,11 +11,11 @@ class TestEvents < Test::Unit::TestCase def test_simplesubscribe name = tempfile() - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => name, :ensure => "file" ) - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :name => "echo true", :path => "/usr/bin:/bin", :refreshonly => true, @@ -31,11 +31,11 @@ class TestEvents < Test::Unit::TestCase def test_simplerequire name = tempfile() - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => name, :ensure => "file" ) - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :name => "echo true", :path => "/usr/bin:/bin", :refreshonly => true, @@ -57,14 +57,14 @@ class TestEvents < Test::Unit::TestCase files = [] 4.times { |i| - files << Puppet::Type.type(:file).create( + files << Puppet::Type.type(:file).new( :name => tempfile(), :ensure => "file" ) } fname = tempfile() - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :name => "touch %s" % fname, :path => "/usr/bin:/bin", :refreshonly => true @@ -84,13 +84,13 @@ class TestEvents < Test::Unit::TestCase def test_refreshordering file = tempfile() - exec1 = Puppet::Type.type(:exec).create( + exec1 = Puppet::Type.type(:exec).new( :title => "one", :name => "echo one >> %s" % file, :path => "/usr/bin:/bin" ) - exec2 = Puppet::Type.type(:exec).create( + exec2 = Puppet::Type.type(:exec).new( :title => "two", :name => "echo two >> %s" % file, :path => "/usr/bin:/bin", @@ -98,7 +98,7 @@ class TestEvents < Test::Unit::TestCase :subscribe => exec1 ) - exec3 = Puppet::Type.type(:exec).create( + exec3 = Puppet::Type.type(:exec).new( :title => "three", :name => "echo three >> %s" % file, :path => "/usr/bin:/bin", diff --git a/test/other/overrides.rb b/test/other/overrides.rb index 4053e777d..3c13dabbc 100755 --- a/test/other/overrides.rb +++ b/test/other/overrides.rb @@ -24,7 +24,7 @@ class TestOverrides < Test::Unit::TestCase mksubdirs(basedir, 1) basefile = File.join(basedir, "file") - baseobj = Puppet::Type.type(:file).create( + baseobj = Puppet::Type.type(:file).new( :title => "base", :path => basedir, :recurse => true, @@ -33,7 +33,7 @@ class TestOverrides < Test::Unit::TestCase subdir = File.join(basedir, "0") subfile = File.join(subdir, "file") - subobj = Puppet::Type.type(:file).create( + subobj = Puppet::Type.type(:file).new( :title => "sub", :path => subdir, :recurse => true, @@ -52,7 +52,7 @@ class TestOverrides < Test::Unit::TestCase baseobj = nil assert_nothing_raised("Could not create base obj") { - baseobj = Puppet::Type.type(:file).create( + baseobj = Puppet::Type.type(:file).new( :path => basedir, :recurse => true, :mode => "755" @@ -76,7 +76,7 @@ class TestOverrides < Test::Unit::TestCase end assert_nothing_raised("Could not create sub obj") { - children << Puppet::Type.type(:file).create( + children << Puppet::Type.type(:file).new( :path => subdir, :recurse => true, :mode => mode diff --git a/test/other/relationships.rb b/test/other/relationships.rb index fe71beb7b..f007ca1c1 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -14,7 +14,7 @@ class TestRelationships < Test::Unit::TestCase def newfile assert_nothing_raised() { - return Puppet::Type.type(:file).create( + return Puppet::Type.type(:file).new( :path => tempfile, :check => [:mode, :owner, :group] ) diff --git a/test/other/report.rb b/test/other/report.rb index c862884d6..bfae0dab0 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -21,7 +21,7 @@ class TestReports < Test::Unit::TestCase # Make every third file File.open(file, "w") { |f| f.puts "" } if i % 3 == 0 - objects << Puppet::Type.type(:file).create( + objects << Puppet::Type.type(:file).new( :path => file, :ensure => "file" ) @@ -44,7 +44,7 @@ class TestReports < Test::Unit::TestCase } # Now make a file for testing logging - file = Puppet::Type.type(:file).create(:path => tempfile(), :ensure => "file") + file = Puppet::Type.type(:file).new(:path => tempfile(), :ensure => "file") file.finish log = nil diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 0578d9e5d..568660848 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -53,7 +53,7 @@ class TestTransactions < Test::Unit::TestCase def eval_generate ret = [] if title.length > 1 - ret << self.class.create(:title => title[0..-2]) + ret << self.class.new(:title => title[0..-2]) else return nil end @@ -72,11 +72,11 @@ class TestTransactions < Test::Unit::TestCase path1 = tempfile() path2 = tempfile() objects = [] - objects << Puppet::Type.type(:file).create( + objects << Puppet::Type.type(:file).new( :path => path1, :content => "yayness" ) - objects << Puppet::Type.type(:file).create( + objects << Puppet::Type.type(:file).new( :path => path2, :content => "booness" ) @@ -130,7 +130,7 @@ class TestTransactions < Test::Unit::TestCase end # Now create an instance - inst = type.create :name => "yay" + inst = type.new :name => "yay" # Create a transaction trans = Puppet::Transaction.new(mk_catalog(inst)) @@ -155,13 +155,13 @@ class TestTransactions < Test::Unit::TestCase path = tempfile() firstpath = tempfile() secondpath = tempfile() - file = Puppet::Type.type(:file).create(:title => "file", :path => path, :content => "yayness") - first = Puppet::Type.type(:exec).create(:title => "first", + file = Puppet::Type.type(:file).new(:title => "file", :path => path, :content => "yayness") + first = Puppet::Type.type(:exec).new(:title => "first", :command => "/bin/echo first > #{firstpath}", :subscribe => [:file, path], :refreshonly => true ) - second = Puppet::Type.type(:exec).create(:title => "second", + second = Puppet::Type.type(:exec).new(:title => "second", :command => "/bin/echo second > #{secondpath}", :subscribe => [:exec, "first"], :refreshonly => true @@ -219,13 +219,13 @@ class TestTransactions < Test::Unit::TestCase hash[:name] = tmpfile assert_nothing_raised() { - return Puppet::Type.type(:file).create(hash) + return Puppet::Type.type(:file).new(hash) } end def newexec(file) assert_nothing_raised() { - return Puppet::Type.type(:exec).create( + return Puppet::Type.type(:exec).new( :name => "touch %s" % file, :path => "/bin:/usr/bin:/sbin:/usr/sbin", :returns => 0 @@ -347,12 +347,12 @@ class TestTransactions < Test::Unit::TestCase assert_apply(file) config = Puppet::Resource::Catalog.new - fcomp = Puppet::Type.type(:component).create(:name => "file") + fcomp = Puppet::Type.type(:component).new(:name => "file") config.add_resource fcomp config.add_resource file config.add_edge(fcomp, file) - ecomp = Puppet::Type.type(:component).create(:name => "exec") + ecomp = Puppet::Type.type(:component).new(:name => "exec") config.add_resource ecomp config.add_resource exec config.add_edge(ecomp, exec) @@ -377,17 +377,17 @@ class TestTransactions < Test::Unit::TestCase path = tempfile() file1 = tempfile() file2 = tempfile() - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => path, :ensure => "file" ) - exec1 = Puppet::Type.type(:exec).create( + exec1 = Puppet::Type.type(:exec).new( :path => ENV["PATH"], :command => "touch %s" % file1, :refreshonly => true, :subscribe => [:file, path] ) - exec2 = Puppet::Type.type(:exec).create( + exec2 = Puppet::Type.type(:exec).new( :path => ENV["PATH"], :command => "touch %s" % file2, :refreshonly => true, @@ -404,11 +404,11 @@ class TestTransactions < Test::Unit::TestCase def test_failedrefreshes path = tempfile() newfile = tempfile() - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => path, :ensure => "file" ) - exec1 = Puppet::Type.type(:exec).create( + exec1 = Puppet::Type.type(:exec).new( :path => ENV["PATH"], :command => "touch /this/cannot/possibly/exist", :logoutput => true, @@ -416,7 +416,7 @@ class TestTransactions < Test::Unit::TestCase :subscribe => file, :title => "one" ) - exec2 = Puppet::Type.type(:exec).create( + exec2 = Puppet::Type.type(:exec).new( :path => ENV["PATH"], :command => "touch %s" % newfile, :logoutput => true, @@ -433,14 +433,14 @@ class TestTransactions < Test::Unit::TestCase def test_unscheduled_and_untagged_response Puppet::Type.type(:schedule).mkdefaultschedules Puppet[:ignoreschedules] = false - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => tempfile(), :ensure => "file", :backup => false ) fname = tempfile() - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :name => "touch %s" % fname, :path => "/usr/bin:/bin", :schedule => "monthly", @@ -484,19 +484,19 @@ class TestTransactions < Test::Unit::TestCase end def test_failed_reqs_mean_no_run - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "/bin/mkdir /this/path/cannot/possibly/exit", :title => "mkdir" ) - file1 = Puppet::Type.type(:file).create( + file1 = Puppet::Type.type(:file).new( :title => "file1", :path => tempfile(), :require => exec, :ensure => :file ) - file2 = Puppet::Type.type(:file).create( + file2 = Puppet::Type.type(:file).new( :title => "file2", :path => tempfile(), :require => file1, @@ -527,7 +527,7 @@ class TestTransactions < Test::Unit::TestCase trans.prepare return - resource = Puppet::Type.type(:file).create :ensure => :present, :path => tempfile() + resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile() other_resource = mock 'generated' def resource.generate [other_resource] @@ -599,7 +599,7 @@ class TestTransactions < Test::Unit::TestCase end end - resource = type.create :name => "test" + resource = type.new :name => "test" config = mk_catalog(resource) trans = Puppet::Transaction.new(config) trans.prepare @@ -627,8 +627,8 @@ class TestTransactions < Test::Unit::TestCase File.chmod(0644, file) File.chmod(0755, dir) # So only the child file causes a change - dirobj = Puppet::Type.type(:file).create :mode => "755", :recurse => true, :path => dir - exec = Puppet::Type.type(:exec).create :title => "make", + dirobj = Puppet::Type.type(:file).new :mode => "755", :recurse => true, :path => dir + exec = Puppet::Type.type(:exec).new :title => "make", :command => "touch #{maker}", :path => ENV['PATH'], :refreshonly => true, :subscribe => dirobj @@ -712,9 +712,9 @@ class TestTransactions < Test::Unit::TestCase end def test_set_target - file = Puppet::Type.type(:file).create(:path => tempfile(), :content => "yay") - exec1 = Puppet::Type.type(:exec).create :command => "/bin/echo exec1" - exec2 = Puppet::Type.type(:exec).create :command => "/bin/echo exec2" + file = Puppet::Type.type(:file).new(:path => tempfile(), :content => "yay") + exec1 = Puppet::Type.type(:exec).new :command => "/bin/echo exec1" + exec2 = Puppet::Type.type(:exec).new :command => "/bin/echo exec2" trans = Puppet::Transaction.new(mk_catalog(file, exec1, exec2)) # First try it with an edge that has no callback @@ -747,8 +747,8 @@ class TestTransactions < Test::Unit::TestCase Puppet::Type.rmtype(:norefresh) end - file = Puppet::Type.type(:file).create :path => tempfile(), :content => "yay" - one = klass.create :name => "one", :subscribe => file + file = Puppet::Type.type(:file).new :path => tempfile(), :content => "yay" + one = klass.new :name => "one", :subscribe => file assert_apply(file, one) @@ -757,8 +757,8 @@ class TestTransactions < Test::Unit::TestCase # Testing #437 - cyclic graphs should throw failures. def test_fail_on_cycle - one = Puppet::Type.type(:exec).create(:name => "/bin/echo one") - two = Puppet::Type.type(:exec).create(:name => "/bin/echo two") + one = Puppet::Type.type(:exec).new(:name => "/bin/echo one") + two = Puppet::Type.type(:exec).new(:name => "/bin/echo two") one[:require] = two two[:require] = one @@ -781,7 +781,7 @@ class TestTransactions < Test::Unit::TestCase end cleanup { Puppet::Type.rmtype(:failer) } - obj = type.create(:name => "testing") + obj = type.new(:name => "testing") assert_apply(obj) end @@ -802,7 +802,7 @@ class TestTransactions < Test::Unit::TestCase end cleanup { Puppet::Type.rmtype(:refresher)} - obj = type.create(:name => "yay", :testing => "cool") + obj = type.new(:name => "yay", :testing => "cool") assert(! obj.insync?(obj.retrieve), "fake object is already in sync") @@ -816,8 +816,8 @@ class TestTransactions < Test::Unit::TestCase # Create a couple of different resource sets that have automatic relationships and make sure the manual relationships win rels = {} # First users and groups - group = Puppet::Type.type(:group).create(:name => nonrootgroup.name, :ensure => :present) - user = Puppet::Type.type(:user).create(:name => nonrootuser.name, :ensure => :present, :gid => group.title) + group = Puppet::Type.type(:group).new(:name => nonrootgroup.name, :ensure => :present) + user = Puppet::Type.type(:user).new(:name => nonrootuser.name, :ensure => :present, :gid => group.title) # Now add the explicit relationship group[:require] = user @@ -825,8 +825,8 @@ class TestTransactions < Test::Unit::TestCase # Now files d = tempfile() f = File.join(d, "file") - file = Puppet::Type.type(:file).create(:path => f, :content => "yay") - dir = Puppet::Type.type(:file).create(:path => d, :ensure => :directory, :require => file) + file = Puppet::Type.type(:file).new(:path => f, :content => "yay") + dir = Puppet::Type.type(:file).new(:path => d, :ensure => :directory, :require => file) rels[dir] = file rels.each do |after, before| @@ -850,12 +850,12 @@ class TestTransactions < Test::Unit::TestCase path = tempfile epath = tempfile spath = tempfile - file = Puppet::Type.type(:file).create(:path => path, :ensure => :file, + file = Puppet::Type.type(:file).new(:path => path, :ensure => :file, :title => "file") - exec = Puppet::Type.type(:exec).create(:command => "touch %s" % epath, + exec = Puppet::Type.type(:exec).new(:command => "touch %s" % epath, :path => ENV["PATH"], :subscribe => file, :refreshonly => true, :title => 'exec1') - exec2 = Puppet::Type.type(:exec).create(:command => "touch %s" % spath, + exec2 = Puppet::Type.type(:exec).new(:command => "touch %s" % spath, :path => ENV["PATH"], :subscribe => exec, :refreshonly => true, :title => 'exec2') @@ -888,7 +888,7 @@ class TestTransactions < Test::Unit::TestCase 3.times do |i| path = tempfile paths << path - file = Puppet::Type.type(:file).create(:path => path, :ensure => :absent, + file = Puppet::Type.type(:file).new(:path => path, :ensure => :absent, :backup => false, :title => "file%s" % i) File.open(path, "w") { |f| f.puts "" } files << file @@ -929,7 +929,7 @@ class TestTransactions < Test::Unit::TestCase cleanup { Puppet::Type.rmtype(:flushtest) } - obj = type.create(:name => "test", :ensure => :present) + obj = type.new(:name => "test", :ensure => :present) # first make sure it runs through and flushes assert_apply(obj) diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb index 0fd712e51..cad0f2f7a 100755 --- a/test/ral/manager/attributes.rb +++ b/test/ral/manager/attributes.rb @@ -29,7 +29,7 @@ class TestTypeAttributes < Test::Unit::TestCase # and a param type.newparam(:param) - inst = type.create(:name => "yay") + inst = type.new(:name => "yay") # Make sure we can set each of them, including a metaparam [:param, :property, :noop].each do |param| @@ -66,7 +66,7 @@ class TestTypeAttributes < Test::Unit::TestCase type.newproperty(prop) {} end - inst = type.create(:name => "yay") + inst = type.new(:name => "yay") inst[:one] = "boo" one = inst.property(:one) @@ -88,7 +88,7 @@ class TestTypeAttributes < Test::Unit::TestCase @num ||= 0 @num += 1 name = "name%s" % @num - inst = type.create(:name => name) + inst = type.new(:name => name) [:meta, :param, :prop].each do |name| klass = type.attrclass(name) assert(klass, "did not get class for %s" % name) @@ -162,7 +162,7 @@ class TestTypeAttributes < Test::Unit::TestCase assert_nil(type.attr_alias(:name), "got invalid alias info for name") - inst = type.create(:name => "my name") + inst = type.new(:name => "my name") assert(inst, "could not create instance") aliases.each do |new, old| @@ -227,7 +227,7 @@ class TestTypeAttributes < Test::Unit::TestCase # Now make sure that we get warnings and no properties in those cases where our providers do not support the features requested [nope, maybe, yep].each_with_index do |prov, i| - resource = type.create(:provider => prov.name, :name => "test%s" % i, :none => "a", :one => "b", :two => "c") + resource = type.new(:provider => prov.name, :name => "test%s" % i, :none => "a", :one => "b", :two => "c") case prov.name when :nope: @@ -257,7 +257,7 @@ class TestTypeAttributes < Test::Unit::TestCase file = Puppet::Type.type(:file) klass = file.attrclass(:check) - resource = file.create(:path => tempfile) + resource = file.new(:path => tempfile) inst = klass.new(:resource => resource) {:property => [:owner, :group], :parameter => [:ignore, :recurse], :metaparam => [:require, :subscribe]}.each do |attrtype, attrs| @@ -308,7 +308,7 @@ class TestTypeAttributes < Test::Unit::TestCase end cleanup { Puppet::Type.rmtype(:unsupported) } - obj = type.create(:name => "test", :check => :yep) + obj = type.new(:name => "test", :check => :yep) obj.expects(:newattr).with(:nope).never obj[:check] = :all end diff --git a/test/ral/manager/instances.rb b/test/ral/manager/instances.rb index 5305b3ff3..b9ac5843a 100755 --- a/test/ral/manager/instances.rb +++ b/test/ral/manager/instances.rb @@ -64,9 +64,9 @@ class TestTypeInstances < Test::Unit::TestCase # Now make a couple of instances, so we know we correctly match instead of always # trying to create new ones. - one = @type.create(:name => :one, :ensure => :present) - three = @type.create(:name => :three, :ensure => :present, :provider => :sub) - five = @type.create(:name => :five, :ensure => :present, :provider => :yep) + one = @type.new(:name => :one, :ensure => :present) + three = @type.new(:name => :three, :ensure => :present, :provider => :sub) + five = @type.new(:name => :five, :ensure => :present, :provider => :yep) result = nil assert_nothing_raised("Could not get instance list") do diff --git a/test/ral/manager/provider.rb b/test/ral/manager/provider.rb index 89aa49b9e..86008b13d 100755 --- a/test/ral/manager/provider.rb +++ b/test/ral/manager/provider.rb @@ -54,7 +54,7 @@ class TestTypeProviders < Test::Unit::TestCase # first make sure we can pass the name in resource = nil assert_nothing_raised("Could not create provider instance by name") do - resource = @type.create :name => "yay", :provider => :testing + resource = @type.new :name => "yay", :provider => :testing end assert_instance_of(provider, resource.provider, "Did not create provider instance") @@ -62,7 +62,7 @@ class TestTypeProviders < Test::Unit::TestCase # Now make sure we can pass in an instance provinst = provider.new(:name => "foo") assert_nothing_raised("Could not pass in provider instance") do - resource = @type.create :name => "foo", :provider => provinst + resource = @type.new :name => "foo", :provider => provinst end assert_equal(provinst, resource.provider, "Did not retain provider instance") @@ -74,11 +74,11 @@ class TestTypeProviders < Test::Unit::TestCase end # And make sure the provider must be a valid provider type for this resource - pkgprov = Puppet::Type.type(:package).create(:name => "yayness").provider + pkgprov = Puppet::Type.type(:package).new(:name => "yayness").provider assert(provider, "did not get package provider") assert_raise(Puppet::Error, "Did not fail on invalid provider instance") do - resource = @type.create :name => "bar", :provider => pkgprov + resource = @type.new :name => "bar", :provider => pkgprov end end @@ -89,7 +89,7 @@ class TestTypeProviders < Test::Unit::TestCase Puppet::Type.type(:user).provider(:useradd).stubs(:suitable?).returns false assert_nothing_raised("Unsuitable providers failed at initialization") do - Puppet::Type.type(:user).create :name => "luke", :ensure => :present, :provider => :useradd + Puppet::Type.type(:user).new :name => "luke", :ensure => :present, :provider => :useradd end end @@ -98,7 +98,7 @@ class TestTypeProviders < Test::Unit::TestCase def test_unsuitable_providers_should_fail_at_evaluation Puppet::Type.type(:user).provider(:useradd).stubs(:suitable?).returns false - user = Puppet::Type.type(:user).create :name => "luke", :ensure => :present, :provider => :useradd + user = Puppet::Type.type(:user).new :name => "luke", :ensure => :present, :provider => :useradd assert_raise(Puppet::Error, "Unsuitable provider did not fail at evaluation") do user.evaluate end diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 4b50e3d5d..d6b7b2a1d 100755 --- a/test/ral/manager/type.rb +++ b/test/ral/manager/type.rb @@ -52,7 +52,7 @@ class TestType < Test::Unit::TestCase path = tempfile() assert_nothing_raised() { system("rm -f %s" % path) - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => path, :ensure => "file", :recurse => true, @@ -67,7 +67,7 @@ class TestType < Test::Unit::TestCase } assert_nothing_raised() { system("rm -f %s" % path) - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( "path" => path, "ensure" => "file", "recurse" => true, @@ -101,7 +101,7 @@ class TestType < Test::Unit::TestCase # currently groups are the only objects with the namevar as a property group = nil assert_nothing_raised { - group = Puppet::Type.type(:group).create( + group = Puppet::Type.type(:group).new( :name => "testing" ) } @@ -110,7 +110,7 @@ class TestType < Test::Unit::TestCase end def test_aliases_are_added_to_catalog - resource = Puppet::Type.type(:file).create( + resource = Puppet::Type.type(:file).new( :name => "/path/to/some/missing/file", :ensure => "file" ) @@ -127,7 +127,7 @@ class TestType < Test::Unit::TestCase end def test_aliasing_fails_without_a_catalog - resource = Puppet::Type.type(:file).create( + resource = Puppet::Type.type(:file).new( :name => "/no/such/file", :ensure => "file" ) @@ -145,14 +145,14 @@ class TestType < Test::Unit::TestCase twoobj = nil oneobj = nil assert_nothing_raised("Could not create prereq that doesn't exist yet") { - twoobj = Puppet::Type.type(:file).create( + twoobj = Puppet::Type.type(:file).new( :name => two, :require => [:file, one] ) } assert_nothing_raised { - oneobj = Puppet::Type.type(:file).create( + oneobj = Puppet::Type.type(:file).new( :name => one ) } @@ -170,7 +170,7 @@ class TestType < Test::Unit::TestCase def test_ensuredefault user = nil assert_nothing_raised { - user = Puppet::Type.type(:user).create( + user = Puppet::Type.type(:user).new( :name => "pptestAA", :check => [:uid] ) @@ -180,7 +180,7 @@ class TestType < Test::Unit::TestCase assert(! user.property(:ensure), "User got an ensure property") assert_nothing_raised { - user = Puppet::Type.type(:user).create( + user = Puppet::Type.type(:user).new( :name => "pptestAB", :comment => "Testingness" ) @@ -189,7 +189,7 @@ class TestType < Test::Unit::TestCase assert(user.property(:ensure), "User did not add ensure property") assert_nothing_raised { - user = Puppet::Type.type(:user).create( + user = Puppet::Type.type(:user).new( :name => "pptestBC", :comment => "A fake user" ) @@ -341,7 +341,7 @@ class TestType < Test::Unit::TestCase obj = nil path = tempfile() assert_raise ArgumentError do - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :name => path, :path => path ) @@ -378,14 +378,14 @@ class TestType < Test::Unit::TestCase echo = Puppet::Util.binary "echo" exec1 = exec2 = nil assert_nothing_raised do - exec1 = Puppet::Type.type(:exec).create( + exec1 = Puppet::Type.type(:exec).new( :title => "exec1", :command => "#{echo} funtest" ) end catalog.add_resource(exec1) assert_nothing_raised do - exec2 = Puppet::Type.type(:exec).create( + exec2 = Puppet::Type.type(:exec).new( :title => "exec2", :command => "#{echo} funtest" ) @@ -395,14 +395,14 @@ class TestType < Test::Unit::TestCase # Now do files, since they are. This should fail. file1 = file2 = nil path = tempfile() - file1 = Puppet::Type.type(:file).create( + file1 = Puppet::Type.type(:file).new( :title => "file1", :path => path, :content => "yayness" ) catalog.add_resource(file1) - file2 = Puppet::Type.type(:file).create( + file2 = Puppet::Type.type(:file).new( :title => "file2", :path => path, :content => "rahness" @@ -411,7 +411,7 @@ class TestType < Test::Unit::TestCase end def test_tags - obj = Puppet::Type.type(:file).create(:path => tempfile()) + obj = Puppet::Type.type(:file).new(:path => tempfile()) tags = [:some, :test, :tags] @@ -530,7 +530,7 @@ class TestType < Test::Unit::TestCase # Partially test #704, but also cover the rest of the schedule management bases. def test_schedule - schedule = Puppet::Type.type(:schedule).create(:name => "maint") + schedule = Puppet::Type.type(:schedule).new(:name => "maint") catalog = mk_catalog(schedule) {"maint" => true, nil => false, :fail => :fail}.each do |name, should| @@ -538,7 +538,7 @@ class TestType < Test::Unit::TestCase if name args[:schedule] = name end - resource = Puppet::Type.type(:file).create(args) + resource = Puppet::Type.type(:file).new(args) catalog.add_resource(resource) if should == :fail @@ -566,7 +566,7 @@ class TestType < Test::Unit::TestCase # #801 -- resources only checked in noop should be rescheduled immediately. def test_reschedule_when_noop Puppet::Type.type(:schedule).mkdefaultschedules - file = Puppet::Type.type(:file).create(:path => "/tmp/whatever", :mode => "755", :noop => true, :schedule => :daily, :ensure => :file) + file = Puppet::Type.type(:file).new(:path => "/tmp/whatever", :mode => "755", :noop => true, :schedule => :daily, :ensure => :file) assert(file.noop?, "File not considered in noop") assert(file.scheduled?, "File is not considered scheduled") diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb index d9f460258..2ad7997a2 100755 --- a/test/ral/providers/cron/crontab.rb +++ b/test/ral/providers/cron/crontab.rb @@ -435,13 +435,13 @@ class TestCronParsedProvider < Test::Unit::TestCase # Now make some crons that should match matchers = [ - @type.create( + @type.new( :name => "yaycron", :minute => [0, 30], :command => "date", :user => @me ), - @type.create( + @type.new( :name => "youtest", :command => "yaytest", :user => you @@ -449,14 +449,14 @@ class TestCronParsedProvider < Test::Unit::TestCase ] nonmatchers = [ - @type.create( + @type.new( :name => "footest", :minute => [0, 30], :hour => 1, :command => "fooness", :user => @me # wrong target ), - @type.create( + @type.new( :name => "funtest2", :command => "funtest", :user => you # wrong target for this cron @@ -464,7 +464,7 @@ class TestCronParsedProvider < Test::Unit::TestCase ] # Create another cron so we prefetch two of them - @type.create(:name => "testing", :minute => 30, :command => "whatever", :user => "you") + @type.new(:name => "testing", :minute => 30, :command => "whatever", :user => "you") assert_nothing_raised("Could not prefetch cron") do @provider.prefetch([matchers, nonmatchers].flatten.inject({}) { |crons, cron| crons[cron.name] = cron; crons }) @@ -555,7 +555,7 @@ class TestCronParsedProvider < Test::Unit::TestCase end def test_prefetch - cron = @type.create :command => "/bin/echo yay", :name => "test", :hour => 4 + cron = @type.new :command => "/bin/echo yay", :name => "test", :hour => 4 assert_nothing_raised("Could not prefetch cron") do cron.provider.class.prefetch("test" => cron) @@ -570,7 +570,7 @@ class TestCronParsedProvider < Test::Unit::TestCase target = @provider.target_object(@me) # First with no env settings - resource = @type.create :command => "/bin/echo yay", :name => "test", :hour => 4 + resource = @type.new :command => "/bin/echo yay", :name => "test", :hour => 4 cron = resource.provider cron.ensure = :present diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb index 520d9f7ec..044545be1 100755 --- a/test/ral/providers/group.rb +++ b/test/ral/providers/group.rb @@ -240,7 +240,7 @@ class TestGroupProvider < Test::Unit::TestCase def test_autogen provider = nil - group = Puppet::Type.type(:group).create(:name => nonrootgroup.name) + group = Puppet::Type.type(:group).new(:name => nonrootgroup.name) provider = group.provider assert(provider, "did not get provider") diff --git a/test/ral/providers/package/aptitude.rb b/test/ral/providers/package/aptitude.rb index 881f54047..a7c0c84ac 100755 --- a/test/ral/providers/package/aptitude.rb +++ b/test/ral/providers/package/aptitude.rb @@ -14,7 +14,7 @@ class AptitudePackageProviderTest < PuppetTest::TestCase end def test_install - pkg = @type.create :name => 'faff', + pkg = @type.new :name => 'faff', :provider => :aptitude, :ensure => :present, :source => "/tmp/faff.deb" @@ -46,7 +46,7 @@ class AptitudePackageProviderTest < PuppetTest::TestCase end def test_purge - pkg = @type.create :name => 'faff', :provider => :aptitude, :ensure => :purged + pkg = @type.new :name => 'faff', :provider => :aptitude, :ensure => :purged pkg.provider.expects( :dpkgquery diff --git a/test/ral/providers/package/aptrpm.rb b/test/ral/providers/package/aptrpm.rb index 32e0ea6e5..8a107c4d7 100755 --- a/test/ral/providers/package/aptrpm.rb +++ b/test/ral/providers/package/aptrpm.rb @@ -14,7 +14,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase end def test_install - pkg = @type.create :name => 'faff', + pkg = @type.new :name => 'faff', :provider => :aptrpm, :ensure => :present, :source => "/tmp/faff.rpm" @@ -43,7 +43,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase end def test_uninstall - pkg = @type.create :name => 'faff', :provider => :aptrpm, :ensure => :absent + pkg = @type.new :name => 'faff', :provider => :aptrpm, :ensure => :absent pkg.provider.expects( :rpm @@ -71,7 +71,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase # LAK: I don't know where this test will ever return true.. def disabled_test_latest - pkg = @type.create :name => 'ssh', :provider => :aptrpm + pkg = @type.new :name => 'ssh', :provider => :aptrpm assert(pkg, "did not create pkg") status = pkg.provider.query diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb index 18fe70fd0..aef2a5492 100755 --- a/test/ral/providers/parsedfile.rb +++ b/test/ral/providers/parsedfile.rb @@ -47,7 +47,7 @@ class TestParsedFile < Test::Unit::TestCase options[:two] ||= "c" options[:name] ||= name - resource = @type.create(options) + resource = @type.new(options) end def mkprovider(name = :parsed) @@ -610,7 +610,7 @@ class TestParsedFile < Test::Unit::TestCase # Now make a resource bill = nil assert_nothing_raised do - bill = @type.create :name => "bill" + bill = @type.new :name => "bill" end assert_equal("a", bill.provider.one, @@ -627,7 +627,7 @@ class TestParsedFile < Test::Unit::TestCase bill = nil assert_nothing_raised do - bill = @type.create :name => "bill", + bill = @type.new :name => "bill", :one => "a", :two => "c" end @@ -683,7 +683,7 @@ class TestParsedFile < Test::Unit::TestCase otarget.write("oname b d\n") # Now make a resource that targets elsewhat. - res = @type.create(:name => "test", :one => "a", :two => "c", + res = @type.new(:name => "test", :one => "a", :two => "c", :target => opath) assert(res.property(:target), "Target is a parameter, not a property") diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb index 70f606a37..25f1d605f 100755 --- a/test/ral/providers/provider.rb +++ b/test/ral/providers/provider.rb @@ -319,7 +319,7 @@ class TestProvider < Test::Unit::TestCase def test_initialize test = @type.provide(:test) - inst = @type.create :name => "boo" + inst = @type.new :name => "boo" prov = nil assert_nothing_raised("Could not init with a resource") do prov = test.new(inst) @@ -381,7 +381,7 @@ class TestProviderFeatures < Test::Unit::TestCase end end - resource = @type.create(:name => "foo") + resource = @type.new(:name => "foo") {:numbers => [:numeric], :letters => [:alpha], :both => [:numeric, :alpha], :mixed => [], :neither => []}.each do |name, should| should.sort! { |a,b| a.to_s <=> b.to_s } diff --git a/test/ral/providers/service/base.rb b/test/ral/providers/service/base.rb index 934127a10..c11ce4801 100755 --- a/test/ral/providers/service/base.rb +++ b/test/ral/providers/service/base.rb @@ -22,7 +22,7 @@ class TestBaseServiceProvider < Test::Unit::TestCase end commands[c.to_sym] = path end - service = Puppet::Type.type(:service).create( + service = Puppet::Type.type(:service).new( :name => "yaytest", :provider => :base, :start => "%s %s" % [commands[:touch], running], :status => "%s -f %s" % [commands[:test], running], @@ -51,7 +51,7 @@ class TestBaseServiceProvider < Test::Unit::TestCase # Testing #454 def test_that_failures_propagate nope = "/no/such/command" - service = Puppet::Type.type(:service).create( + service = Puppet::Type.type(:service).new( :name => "yaytest", :provider => :base, :start => nope, :status => nope, diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb index 567c01bbc..1cb139b7d 100755 --- a/test/ral/providers/user.rb +++ b/test/ral/providers/user.rb @@ -370,7 +370,7 @@ class TestUserProvider < Test::Unit::TestCase 5.times do |i| i += 1 name = "pptstgr%s" % i - tmpgroup = Puppet::Type.type(:group).create( + tmpgroup = Puppet::Type.type(:group).new( :name => name, :gid => max + i ) @@ -538,7 +538,7 @@ class TestUserProvider < Test::Unit::TestCase def test_autogen provider = nil - user = Puppet::Type.type(:user).create(:name => nonrootuser.name) + user = Puppet::Type.type(:user).new(:name => nonrootuser.name) provider = user.provider assert(provider, "did not get provider") diff --git a/test/ral/providers/user/useradd.rb b/test/ral/providers/user/useradd.rb index 28692be6c..f791a054a 100755 --- a/test/ral/providers/user/useradd.rb +++ b/test/ral/providers/user/useradd.rb @@ -25,7 +25,7 @@ class UserAddProviderTest < PuppetTest::TestCase end def setup_user - @user = @type.create(@vals) + @user = @type.new(@vals) @vals.each do |name, val| next unless @user.class.validproperty?(name) @@ -230,7 +230,7 @@ class UserRootAddProviderTest < PuppetTest::TestCase confine "not running as root" => (Process.uid == 0) def test_password - user = Puppet::Type.type(:user).create(:name => "root", :check => [:password], :provider => :useradd) + user = Puppet::Type.type(:user).new(:name => "root", :check => [:password], :provider => :useradd) provider = user.provider diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb index 70ae2d4e8..6eceb273d 100755 --- a/test/ral/type/cron.rb +++ b/test/ral/type/cron.rb @@ -77,7 +77,7 @@ class TestCron < Test::Unit::TestCase args = {:command => command, :name => name} end assert_nothing_raised { - cron = @crontype.create(args) + cron = @crontype.new(args) } return cron @@ -124,7 +124,7 @@ class TestCron < Test::Unit::TestCase name = "yaytest" command = "date > /dev/null " assert_nothing_raised { - cron = @crontype.create( + cron = @crontype.new( :name => name, :command => "date > /dev/null ", :month => "May", @@ -224,7 +224,7 @@ class TestCron < Test::Unit::TestCase eachprovider do |provider| cron = nil assert_nothing_raised { - cron = @crontype.create( + cron = @crontype.new( :command => "/bin/date > /dev/null", :minute => [0, 30], :name => "crontest", @@ -250,7 +250,7 @@ class TestCron < Test::Unit::TestCase def test_fieldremoval cron = nil assert_nothing_raised { - cron = @crontype.create( + cron = @crontype.new( :command => "/bin/date > /dev/null", :minute => [0, 30], :name => "crontest", @@ -282,7 +282,7 @@ class TestCron < Test::Unit::TestCase cleanup { provider.filetype = ft } setme - cron = @crontype.create(:name => "testing", + cron = @crontype.new(:name => "testing", :minute => [0, 30], :command => "/bin/testing", :user => @me @@ -424,7 +424,7 @@ class TestCron < Test::Unit::TestCase crons = [] users = ["root", nonrootuser.name] users.each do |user| - cron = Puppet::Type.type(:cron).create( + cron = Puppet::Type.type(:cron).new( :name => "testcron-#{user}", :user => user, :command => "/bin/echo", @@ -455,7 +455,7 @@ class TestCron < Test::Unit::TestCase def test_default_user crontab = @crontype.provider(:crontab) if crontab.suitable? - inst = @crontype.create( + inst = @crontype.new( :name => "something", :command => "/some/thing", :provider => :crontab) assert_equal(Etc.getpwuid(Process.uid).name, inst.should(:user), @@ -465,7 +465,7 @@ class TestCron < Test::Unit::TestCase # Now make a new cron with a user, and make sure it gets copied # over - inst = @crontype.create(:name => "yay", :command => "/some/thing", + inst = @crontype.new(:name => "yay", :command => "/some/thing", :user => "bin", :provider => :crontab) assert_equal("bin", inst.should(:target), "target did not default to user with crontab") @@ -475,10 +475,10 @@ class TestCron < Test::Unit::TestCase # #705 - make sure extra spaces don't screw things up def test_spaces_in_command string = "echo multiple spaces" - cron = @crontype.create(:name => "space testing", :command => string) + cron = @crontype.new(:name => "space testing", :command => string) assert_apply(cron) - cron = @crontype.create(:name => "space testing", :command => string) + cron = @crontype.new(:name => "space testing", :command => string) # Now make sure that it's correctly in sync cron.provider.class.prefetch("testing" => cron) diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb index 1d4d8ddfb..f04b3c908 100755 --- a/test/ral/type/exec.rb +++ b/test/ral/type/exec.rb @@ -10,7 +10,7 @@ class TestExec < Test::Unit::TestCase command = nil output = nil assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "/bin/echo" ) } @@ -25,7 +25,7 @@ class TestExec < Test::Unit::TestCase command = nil output = nil assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "/bin/echo", :returns => val ) @@ -38,23 +38,23 @@ class TestExec < Test::Unit::TestCase command = nil output = nil assert_raise(Puppet::Error) { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "echo" ) } assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "echo", :path => "/usr/bin:/bin:/usr/sbin:/sbin" ) } assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "/bin/echo" ) } assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "/bin/echo", :path => "/usr/bin:/bin:/usr/sbin:/sbin" ) @@ -63,21 +63,21 @@ class TestExec < Test::Unit::TestCase def test_nonzero_returns assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "mkdir /this/directory/does/not/exist", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 1 ) } assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "touch /etc", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 1 ) } assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "thiscommanddoesnotexist", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 127 @@ -92,7 +92,7 @@ class TestExec < Test::Unit::TestCase Dir.getwd } assert_nothing_raised { - command = Puppet::Type.type(:exec).create( + command = Puppet::Type.type(:exec).new( :command => "pwd", :cwd => dir, :path => "/usr/bin:/bin:/usr/sbin:/sbin", @@ -109,7 +109,7 @@ class TestExec < Test::Unit::TestCase tmpfile = tempfile() @@tmpfiles.push tmpfile trans = nil - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => tmpfile, :content => "yay" ) @@ -119,7 +119,7 @@ class TestExec < Test::Unit::TestCase # Now make an exec maker = tempfile() assert_nothing_raised { - cmd = Puppet::Type.type(:exec).create( + cmd = Puppet::Type.type(:exec).new( :command => "touch %s" % maker, :path => "/usr/bin:/bin:/usr/sbin:/sbin", :subscribe => file, @@ -145,7 +145,7 @@ class TestExec < Test::Unit::TestCase def test_refreshonly cmd = true assert_nothing_raised { - cmd = Puppet::Type.type(:exec).create( + cmd = Puppet::Type.type(:exec).new( :command => "pwd", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :refreshonly => true @@ -168,7 +168,7 @@ class TestExec < Test::Unit::TestCase exec = nil assert(! FileTest.exists?(file), "File already exists") assert_nothing_raised { - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "touch %s" % file, :path => "/usr/bin:/bin:/usr/sbin:/sbin", :creates => file @@ -187,13 +187,13 @@ class TestExec < Test::Unit::TestCase sh = %x{which sh} File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" } - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => oexe, :source => exe, :mode => 0755 ) - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => oexe, :require => [:file, oexe] ) @@ -210,31 +210,31 @@ class TestExec < Test::Unit::TestCase sh = %x{which sh} File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" } - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => oexe, :source => exe, :mode => 755 ) basedir = File.dirname(oexe) - baseobj = Puppet::Type.type(:file).create( + baseobj = Puppet::Type.type(:file).new( :path => basedir, :source => exe, :mode => 755 ) - ofile = Puppet::Type.type(:file).create( + ofile = Puppet::Type.type(:file).new( :path => exe, :mode => 755 ) - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => oexe, :path => ENV["PATH"], :cwd => basedir ) - cat = Puppet::Type.type(:exec).create( + cat = Puppet::Type.type(:exec).new( :command => "cat %s %s" % [exe, oexe], :path => ENV["PATH"] ) @@ -270,7 +270,7 @@ class TestExec < Test::Unit::TestCase exec = nil assert_nothing_raised { - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "touch %s" % bfile, :onlyif => "test -f %s" % afile, :path => ENV['PATH'] @@ -291,7 +291,7 @@ class TestExec < Test::Unit::TestCase exec = nil assert_nothing_raised { - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "touch %s" % bfile, :unless => "test -f %s" % afile, :path => ENV['PATH'] @@ -339,7 +339,7 @@ class TestExec < Test::Unit::TestCase end exec = nil assert_nothing_raised { - exec = Puppet::Type.type(:exec).create(args) + exec = Puppet::Type.type(:exec).new(args) } comp = mk_catalog("usertest", exec) @@ -374,7 +374,7 @@ class TestExec < Test::Unit::TestCase def test_logoutput exec = nil assert_nothing_raised { - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :title => "logoutputesting", :path => "/usr/bin:/bin", :command => "echo logoutput is false", @@ -405,7 +405,7 @@ class TestExec < Test::Unit::TestCase basedir = tempfile() path = File.join(basedir, "subfile") assert_nothing_raised { - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :title => "mkdir", :path => "/usr/bin:/bin", :creates => basedir, @@ -415,7 +415,7 @@ class TestExec < Test::Unit::TestCase } assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => basedir, :recurse => true, :mode => "755", @@ -435,7 +435,7 @@ class TestExec < Test::Unit::TestCase def test_falsevals exec = nil assert_nothing_raised do - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "/bin/touch yayness" ) end @@ -455,7 +455,7 @@ class TestExec < Test::Unit::TestCase file = tempfile() assert_nothing_raised { - exec1 = Puppet::Type.type(:exec).create( + exec1 = Puppet::Type.type(:exec).new( :title => "one", :path => ENV["PATH"], :command => "mkdir #{dir}" @@ -463,7 +463,7 @@ class TestExec < Test::Unit::TestCase } assert_nothing_raised("Could not create exec w/out existing cwd") { - exec2 = Puppet::Type.type(:exec).create( + exec2 = Puppet::Type.type(:exec).new( :title => "two", :path => ENV["PATH"], :command => "touch #{file}", @@ -497,7 +497,7 @@ class TestExec < Test::Unit::TestCase test = "test -f #{file}" assert_nothing_raised { - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :path => ENV["PATH"], :command => "touch #{file}" ) @@ -534,7 +534,7 @@ class TestExec < Test::Unit::TestCase def test_missing_checks_cause_failures # Solaris's sh exits with 1 here instead of 127 return if Facter.value(:operatingsystem) == "Solaris" - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "echo true", :path => ENV["PATH"], :onlyif => "/bin/nosuchthingexists" @@ -626,7 +626,7 @@ and stuff" end def test_timeout - exec = Puppet::Type.type(:exec).create(:command => "sleep 1", :path => ENV["PATH"], :timeout => "0.2") + exec = Puppet::Type.type(:exec).new(:command => "sleep 1", :path => ENV["PATH"], :timeout => "0.2") time = Time.now assert_raise(Timeout::Error) { @@ -644,7 +644,7 @@ and stuff" if Process.uid == 0 user = "nosuchuser" assert_nothing_raised("Could not create exec with non-existent user") do - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "/bin/echo yay", :user => user ) @@ -654,7 +654,7 @@ and stuff" # Now try the group group = "nosuchgroup" assert_nothing_raised("Could not create exec with non-existent user") do - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :command => "/bin/echo yay", :group => group ) @@ -666,17 +666,17 @@ and stuff" path = %w{/usr/bin /usr/sbin /sbin} exec = nil assert_nothing_raised("Could not use an array for the path") do - exec = Puppet::Type.type(:exec).create(:command => "echo yay", + exec = Puppet::Type.type(:exec).new(:command => "echo yay", :path => path) end assert_equal(path, exec[:path], "array-based path did not match") assert_nothing_raised("Could not use a string for the path") do - exec = Puppet::Type.type(:exec).create(:command => "echo yay", + exec = Puppet::Type.type(:exec).new(:command => "echo yay", :path => path.join(":")) end assert_equal(path, exec[:path], "string-based path did not match") assert_nothing_raised("Could not use a colon-separated strings in an array for the path") do - exec = Puppet::Type.type(:exec).create(:command => "echo yay", + exec = Puppet::Type.type(:exec).new(:command => "echo yay", :path => ["/usr/bin", "/usr/sbin:/sbin"]) end assert_equal(path, exec[:path], "colon-separated array path did not match") @@ -685,7 +685,7 @@ and stuff" def test_checks_apply_to_refresh file = tempfile() maker = tempfile() - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :title => "maker", :command => "touch #{maker}", :path => ENV["PATH"] @@ -724,7 +724,7 @@ and stuff" def test_explicit_refresh refresher = tempfile() maker = tempfile() - exec = Puppet::Type.type(:exec).create( + exec = Puppet::Type.type(:exec).new( :title => "maker", :command => "touch #{maker}", :path => ENV["PATH"] @@ -754,8 +754,8 @@ and stuff" if Puppet.features.root? def test_autorequire_user - user = Puppet::Type.type(:user).create(:name => "yay") - exec = Puppet::Type.type(:exec).create(:command => "/bin/echo fun", :user => "yay") + user = Puppet::Type.type(:user).new(:name => "yay") + exec = Puppet::Type.type(:exec).new(:command => "/bin/echo fun", :user => "yay") rels = nil assert_nothing_raised("Could not evaluate autorequire") do diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index f452ab728..ec81c61a1 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -13,7 +13,7 @@ class TestFile < Test::Unit::TestCase def mkfile(hash) file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create(hash) + file = Puppet::Type.type(:file).new(hash) } return file end @@ -104,7 +104,7 @@ class TestFile < Test::Unit::TestCase def test_groups_fails_when_invalid assert_raise(Puppet::Error, "did not fail when the group was empty") do - Puppet::Type.type(:file).create :path => "/some/file", :group => "" + Puppet::Type.type(:file).new :path => "/some/file", :group => "" end end @@ -118,7 +118,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => path, :owner => user.name, :ensure => "file", @@ -148,7 +148,7 @@ class TestFile < Test::Unit::TestCase obj = nil assert_nothing_raised { - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :title => link, :owner => user.name ) @@ -302,7 +302,7 @@ class TestFile < Test::Unit::TestCase %w{a b c d}.collect { |name| tempfile() + name.to_s }.each { |path| file =nil assert_nothing_raised() { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => path, :ensure => "file" ) @@ -321,7 +321,7 @@ class TestFile < Test::Unit::TestCase %w{a b c d}.collect { |name| "#{basedir}/%s" % name }.each { |path| file = nil assert_nothing_raised() { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => path, :ensure => "directory" ) @@ -365,13 +365,13 @@ class TestFile < Test::Unit::TestCase initstorage assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( param => path, :recurse => true, :checksum => "md5" ) } - comp = Puppet::Type.type(:component).create( + comp = Puppet::Type.type(:component).new( :name => "component" ) comp.push file @@ -387,7 +387,7 @@ class TestFile < Test::Unit::TestCase end def test_recurse? - file = Puppet::Type.type(:file).create :path => tempfile + file = Puppet::Type.type(:file).new :path => tempfile # Make sure we default to false assert(! file.recurse?, "Recurse defaulted to true") @@ -412,7 +412,7 @@ class TestFile < Test::Unit::TestCase dir = nil [true, "true", "inf", 50].each do |value| assert_nothing_raised { - dir = Puppet::Type.type(:file).create( + dir = Puppet::Type.type(:file).new( :path => basedir, :recurse => value, :check => %w{owner mode group} @@ -454,7 +454,7 @@ class TestFile < Test::Unit::TestCase # Verify it retrieves files of type directory assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => tmpdir(), :check => :type ) @@ -468,7 +468,7 @@ class TestFile < Test::Unit::TestCase # And then check files assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => tempfile(), :ensure => "file" ) @@ -503,7 +503,7 @@ class TestFile < Test::Unit::TestCase file = nil dirobj = nil assert_nothing_raised("Could not make file object") { - dirobj = Puppet::Type.type(:file).create( + dirobj = Puppet::Type.type(:file).new( :path => dir, :recurse => true, :check => %w{mode owner group} @@ -528,12 +528,12 @@ class TestFile < Test::Unit::TestCase basedir = tempfile() subfile = File.join(basedir, "subfile") - baseobj = Puppet::Type.type(:file).create( + baseobj = Puppet::Type.type(:file).new( :name => basedir, :ensure => "directory" ) - subobj = Puppet::Type.type(:file).create( + subobj = Puppet::Type.type(:file).new( :name => subfile, :ensure => "file" ) @@ -552,7 +552,7 @@ class TestFile < Test::Unit::TestCase subpath = File.join(path, "this", "is", "a", "dir") file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => subpath, :ensure => "directory", :recurse => true @@ -574,7 +574,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => dest, :checksum => "md5", :content => "This is some content" @@ -594,7 +594,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => dest, :checksum => "md5", :ensure => "file" @@ -613,7 +613,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :title => "fileness", :path => path, :content => "this is some content" @@ -629,7 +629,7 @@ class TestFile < Test::Unit::TestCase def test_missinggroup file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => tempfile(), :group => "fakegroup" ) @@ -640,7 +640,7 @@ class TestFile < Test::Unit::TestCase def test_modecreation path = tempfile() - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => path, :ensure => "file", :mode => "0777" @@ -664,7 +664,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => path, :ensure => "file", :content => "some text\n", @@ -684,7 +684,7 @@ class TestFile < Test::Unit::TestCase File.open(file, "w", 0411) { |f| f.puts "yayness" } - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :path => file, :content => "rahness\n", :backup => ".puppet-bak" ) catalog = mk_catalog(obj) @@ -701,7 +701,7 @@ class TestFile < Test::Unit::TestCase name = "bucket" bpath = tempfile() Dir.mkdir(bpath) - bucket = Puppet::Type.type(:filebucket).create(:title => name, :path => bpath) + bucket = Puppet::Type.type(:filebucket).new(:title => name, :path => bpath) catalog.add_resource(bucket) obj[:backup] = name @@ -724,7 +724,7 @@ class TestFile < Test::Unit::TestCase 500.times { |i| f.puts "line %s" % i } } - resource = Puppet::Type.type(:file).create( + resource = Puppet::Type.type(:file).new( :title => dest, :source => source ) @@ -749,7 +749,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :ensure => path, :path => link ) @@ -769,7 +769,7 @@ class TestFile < Test::Unit::TestCase dest = File.join(dir, "another space") File.open(source, "w") { |f| f.puts :yay } - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :path => dest, :source => source ) @@ -802,18 +802,18 @@ class TestFile < Test::Unit::TestCase home = nil ogroup = nil assert_nothing_raised { - user = Puppet::Type.type(:user).create( + user = Puppet::Type.type(:user).new( :name => "pptestu", :home => file, :gid => "pptestg" ) - home = Puppet::Type.type(:file).create( + home = Puppet::Type.type(:file).new( :path => file, :owner => "pptestu", :group => "pptestg", :ensure => "directory" ) - group = Puppet::Type.type(:group).create( + group = Puppet::Type.type(:group).new( :name => "pptestg" ) comp = mk_catalog(user, group, home) @@ -846,7 +846,7 @@ class TestFile < Test::Unit::TestCase dir = tempfile() Dir.mkdir(dir) - bucket = Puppet::Type.type(:filebucket).create :name => "main" + bucket = Puppet::Type.type(:filebucket).new :name => "main" File.symlink(dir, link) File.open(file, "w") { |f| f.puts "" } assert_equal(dir, File.readlink(link)) @@ -897,7 +897,7 @@ class TestFile < Test::Unit::TestCase :link => proc { File.symlink(linkdest, path) } } - bucket = Puppet::Type.type(:filebucket).create :name => "main", :path => tempfile() + bucket = Puppet::Type.type(:filebucket).new :name => "main", :path => tempfile() obj = Puppet::Type.newfile :path => path, :force => true, :links => :manage @@ -1040,7 +1040,7 @@ class TestFile < Test::Unit::TestCase assert_equal("main", file.bucket, "file's bucket was not set") # And then an existing bucket - obj = Puppet::Type.type(:filebucket).create :name => "testing" + obj = Puppet::Type.type(:filebucket).new :name => "testing" catalog.add_resource(obj) bucket = obj.bucket diff --git a/test/ral/type/file/target.rb b/test/ral/type/file/target.rb index 3806f2a9b..ab73974d6 100755 --- a/test/ral/type/file/target.rb +++ b/test/ral/type/file/target.rb @@ -24,7 +24,7 @@ class TestFileTarget < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :title => "somethingelse", :ensure => path, :path => link @@ -52,7 +52,7 @@ class TestFileTarget < Test::Unit::TestCase system("mkdir -p %s" % subdir) system("touch %s" % file) - link = Puppet::Type.type(:file).create( + link = Puppet::Type.type(:file).new( :ensure => source, :path => path, :recurse => true @@ -97,7 +97,7 @@ class TestFileTarget < Test::Unit::TestCase link = nil assert_nothing_raised { - link = Puppet::Type.type(:file).create( + link = Puppet::Type.type(:file).new( :ensure => source, :path => dest, :recurse => true @@ -132,7 +132,7 @@ class TestFileTarget < Test::Unit::TestCase link = nil assert_nothing_raised { - link = Puppet::Type.type(:file).create( + link = Puppet::Type.type(:file).new( :path => dest, :ensure => "source" ) @@ -149,12 +149,12 @@ class TestFileTarget < Test::Unit::TestCase dest = tempfile() resources = [] - resources << Puppet::Type.type(:exec).create( + resources << Puppet::Type.type(:exec).new( :command => "mkdir %s; touch %s/file" % [source, source], :title => "yay", :path => ENV["PATH"] ) - resources << Puppet::Type.type(:file).create( + resources << Puppet::Type.type(:file).new( :ensure => source, :path => dest, :recurse => true, @@ -203,7 +203,7 @@ class TestFileTarget < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :ensure => path, :path => link, :backup => false @@ -234,7 +234,7 @@ class TestFileTarget < Test::Unit::TestCase File.open(file, "w") { |f| f.puts "yayness" } File.symlink(file, link) - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :path => link, :ensure => "file" ) @@ -265,7 +265,7 @@ class TestFileTarget < Test::Unit::TestCase File.open(sourcefile, "w") { |f| f.puts "source" } File.symlink(file, link) - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :path => dirs["target"], :ensure => :file, :source => dirs["source"], @@ -295,7 +295,7 @@ class TestFileTarget < Test::Unit::TestCase File.open(dest, "w") { |f| f.puts "boo" } File.open(otherdest, "w") { |f| f.puts "yay" } - obj = Puppet::Type.type(:file).create( + obj = Puppet::Type.type(:file).new( :path => link, :ensure => otherdest ) diff --git a/test/ral/type/filebucket.rb b/test/ral/type/filebucket.rb index 4931ba5f2..b18a66f9e 100755 --- a/test/ral/type/filebucket.rb +++ b/test/ral/type/filebucket.rb @@ -15,7 +15,7 @@ class TestFileBucket < Test::Unit::TestCase def mkfile(hash) file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create(hash) + file = Puppet::Type.type(:file).new(hash) } return file end @@ -23,7 +23,7 @@ class TestFileBucket < Test::Unit::TestCase def mkbucket(name,path) bucket = nil assert_nothing_raised { - bucket = Puppet::Type.type(:filebucket).create( + bucket = Puppet::Type.type(:filebucket).new( :name => name, :path => path ) diff --git a/test/ral/type/fileignoresource.rb b/test/ral/type/fileignoresource.rb index b59a8db74..2c36bd3c6 100755 --- a/test/ral/type/fileignoresource.rb +++ b/test/ral/type/fileignoresource.rb @@ -69,7 +69,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase #makes Puppet file Object assert_nothing_raised { - tofile = Puppet::Type.type(:file).create( + tofile = Puppet::Type.type(:file).new( :name => topath, :source => frompath, :recurse => true, @@ -133,7 +133,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase #makes Puppet file Object assert_nothing_raised { - tofile = Puppet::Type.type(:file).create( + tofile = Puppet::Type.type(:file).new( :name => topath, :source => frompath, :recurse => true, @@ -205,7 +205,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase #makes Puppet file Object assert_nothing_raised { - tofile = Puppet::Type.type(:file).create( + tofile = Puppet::Type.type(:file).new( :name => topath, :source => frompath, :recurse => true, diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb index 7a08326ea..573bcb2ce 100755 --- a/test/ral/type/filesources.rb +++ b/test/ral/type/filesources.rb @@ -59,7 +59,7 @@ class TestFileSources < Test::Unit::TestCase tofile = nil trans = nil - tofile = Puppet::Type.type(:file).create( + tofile = Puppet::Type.type(:file).new( :path => todir, :recurse => true, :backup => false, @@ -192,7 +192,7 @@ class TestFileSources < Test::Unit::TestCase File.open(file1, "w") { |f| f.puts "yay" } rootobj = nil assert_nothing_raised { - rootobj = Puppet::Type.type(:file).create( + rootobj = Puppet::Type.type(:file).new( :name => basedir, :recurse => true, :check => %w{type owner}, @@ -264,7 +264,7 @@ class TestFileSources < Test::Unit::TestCase sleep(1) name = File.join(tmpdir(), "nosourcefile") - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :source => "puppet://localhost/noexist/file", :name => name ) @@ -291,7 +291,7 @@ class TestFileSources < Test::Unit::TestCase # Now the files should be exactly the same, so we should not see attempts # at copying assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => to, :source => from ) @@ -317,7 +317,7 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => to, :source => files ) @@ -343,7 +343,7 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => dest, :source => source ) @@ -364,7 +364,7 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :name => dest, :ensure => "file", :source => source @@ -387,7 +387,7 @@ class TestFileSources < Test::Unit::TestCase File.open(source, "w") { |f| f.puts "yay" } File.symlink(source, link) - file = Puppet::Type.type(:file).create(:name => dest, :source => link) + file = Puppet::Type.type(:file).new(:name => dest, :source => link) catalog = mk_catalog(file) diff --git a/test/ral/type/group.rb b/test/ral/type/group.rb index 072c0e9aa..e82144b81 100755 --- a/test/ral/type/group.rb +++ b/test/ral/type/group.rb @@ -47,7 +47,7 @@ class TestGroup < Test::Unit::TestCase group = nil hash[:name] = name assert_nothing_raised { - group = Puppet::Type.type(:group).create(hash) + group = Puppet::Type.type(:group).new(hash) } return group @@ -115,7 +115,7 @@ class TestGroup < Test::Unit::TestCase gobj = nil comp = nil assert_nothing_raised { - gobj = Puppet::Type.type(:group).create( + gobj = Puppet::Type.type(:group).new( :name => group, :check => [:gid] ) @@ -139,7 +139,7 @@ class TestGroup < Test::Unit::TestCase name = "pptestgr" assert_nothing_raised { - gobj = Puppet::Type.type(:group).create( + gobj = Puppet::Type.type(:group).new( :name => name, :gid => 123 ) diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb index 168bb6fd5..5cafddbc0 100755 --- a/test/ral/type/host.rb +++ b/test/ral/type/host.rb @@ -43,7 +43,7 @@ class TestHost < Test::Unit::TestCase host = nil assert_nothing_raised { - host = Puppet::Type.type(:host).create( + host = Puppet::Type.type(:host).new( :name => "fakehost%s" % @hcount, :ip => "192.168.27.%s" % @hcount, :alias => "alias%s" % @hcount, @@ -73,7 +73,7 @@ class TestHost < Test::Unit::TestCase end assert_nothing_raised { - host = Puppet::Type.type(:host).create( + host = Puppet::Type.type(:host).new( :name => "culain", :ip => "192.168.0.3" ) diff --git a/test/ral/type/mailalias.rb b/test/ral/type/mailalias.rb index 637022330..0dc0f6a6a 100755 --- a/test/ral/type/mailalias.rb +++ b/test/ral/type/mailalias.rb @@ -33,7 +33,7 @@ class TestMailAlias < Test::Unit::TestCase # This isn't much of a test, but then, it's not much of a type. def test_recipient_arrays - resource = @type.create(:name => "luke", :recipient => "yay", :target => tempfile) + resource = @type.new(:name => "luke", :recipient => "yay", :target => tempfile) values = nil assert_nothing_raised("Could not retrieve mailalias") do values = resource.retrieve.inject({}) { |hash, a| hash[a[0].name] = a[1]; hash } diff --git a/test/ral/type/port.rb b/test/ral/type/port.rb index d41799aac..20d243d26 100755 --- a/test/ral/type/port.rb +++ b/test/ral/type/port.rb @@ -40,7 +40,7 @@ require 'puppettest' # @pcount = 1 # end # assert_nothing_raised { -# port = Puppet::Type.type(:port).create( +# port = Puppet::Type.type(:port).new( # :name => "puppet%s" % @pcount, # :number => "813%s" % @pcount, # :protocols => "tcp", diff --git a/test/ral/type/resources.rb b/test/ral/type/resources.rb index 552f51253..066a9e6bf 100755 --- a/test/ral/type/resources.rb +++ b/test/ral/type/resources.rb @@ -65,7 +65,7 @@ class TestResources < Test::Unit::TestCase purger = nil assert_nothing_raised do - purger = @type.create :name => "purgetest", :noop => true, :loglevel => :warning + purger = @type.new :name => "purgetest", :noop => true, :loglevel => :warning end assert(purger, "did not get purger manager") add_purge_lister() @@ -126,18 +126,18 @@ class TestResources < Test::Unit::TestCase # Part of #408. def test_check # First check a non-user - res = Puppet::Type.type(:resources).create :name => :package + res = Puppet::Type.type(:resources).new :name => :package assert_nil(res[:unless_system_user], "got bad default for package") assert_nothing_raised { assert(res.check("A String"), "String failed check") - assert(res.check(Puppet::Type.type(:file).create(:path => tempfile())), "File failed check") - assert(res.check(Puppet::Type.type(:user).create(:name => "yayness")), "User failed check in package") + assert(res.check(Puppet::Type.type(:file).new(:path => tempfile())), "File failed check") + assert(res.check(Puppet::Type.type(:user).new(:name => "yayness")), "User failed check in package") } # Now create a user manager - res = Puppet::Type.type(:resources).create :name => :user + res = Puppet::Type.type(:resources).new :name => :user # Make sure the default is 500 assert_equal(500, res[:unless_system_user], "got bad default") @@ -175,7 +175,7 @@ class TestResources < Test::Unit::TestCase # The other half of #408. def test_check_is_called - res = Puppet::Type.type(:resources).create :name => :user, :purge => true + res = Puppet::Type.type(:resources).new :name => :user, :purge => true list = nil assert_nothing_raised { list = res.generate } diff --git a/test/ral/type/service.rb b/test/ral/type/service.rb index 01533c63e..6f78c53ce 100755 --- a/test/ral/type/service.rb +++ b/test/ral/type/service.rb @@ -10,7 +10,7 @@ class TestServiceType < Test::Unit::TestCase # #199 def test_no_refresh_when_starting - service = Puppet::Type.type(:service).create :name => "hopefully_this_isnt_in_the_process_table", + service = Puppet::Type.type(:service).new :name => "hopefully_this_isnt_in_the_process_table", :ensure => :running, :provider => :base assert_equal :running, service.instance_eval('@parameters[:ensure]').should @@ -25,7 +25,7 @@ class TestServiceType < Test::Unit::TestCase end def test_refresh_normally - service = Puppet::Type.type(:service).create :name => "testing", + service = Puppet::Type.type(:service).new :name => "testing", :ensure => :running, :provider => :base, :status => "cat /dev/null" service.provider.expects(:restart) diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb index 3bd6f343b..509a381fc 100755 --- a/test/ral/type/sshkey.rb +++ b/test/ral/type/sshkey.rb @@ -48,7 +48,7 @@ class TestSSHKey < Test::Unit::TestCase @catalog ||= mk_catalog - key = @sshkeytype.create( + key = @sshkeytype.new( :name => "host%s.madstop.com" % @kcount, :key => "%sAAAAB3NzaC1kc3MAAACBAMnhSiku76y3EGkNCDsUlvpO8tRgS9wL4Eh54WZfQ2lkxqfd2uT/RTT9igJYDtm/+UHuBRdNGpJYW1Nw2i2JUQgQEEuitx4QKALJrBotejGOAWxxVk6xsh9xA0OW8Q3ZfuX2DDitfeC8ZTCl4xodUMD8feLtP+zEf8hxaNamLlt/AAAAFQDYJyf3vMCWRLjTWnlxLtOyj/bFpwAAAIEAmRxxXb4jjbbui9GYlZAHK00689DZuX0EabHNTl2yGO5KKxGC6Esm7AtjBd+onfu4Rduxut3jdI8GyQCIW8WypwpJofCIyDbTUY4ql0AQUr3JpyVytpnMijlEyr41FfIb4tnDqnRWEsh2H7N7peW+8DWZHDFnYopYZJ9Yu4/jHRYAAACAERG50e6aRRb43biDr7Ab9NUCgM9bC0SQscI/xdlFjac0B/kSWJYTGVARWBDWug705hTnlitY9cLC5Ey/t/OYOjylTavTEfd/bh/8FkAYO+pWdW3hx6p97TBffK0b6nrc6OORT2uKySbbKOn0681nNQh4a6ueR3JRppNkRPnTk5c=" % @kcount, :type => "ssh-dss", @@ -91,7 +91,7 @@ class TestSSHKey < Test::Unit::TestCase name = key.name key = nil - key = @sshkeytype.create :name => name, :target => file, :provider => :parsed + key = @sshkeytype.new :name => name, :target => file, :provider => :parsed key.retrieve assert(key.provider.exists?, "key thinks it does not exist") diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb index 8f42c7120..627191e38 100755 --- a/test/ral/type/user.rb +++ b/test/ral/type/user.rb @@ -64,7 +64,7 @@ class TestUser < Test::Unit::TestCase def mkuser(name) user = nil assert_nothing_raised { - user = Puppet::Type.type(:user).create( + user = Puppet::Type.type(:user).new( :name => name, :comment => "Puppet Testing User", :gid => Puppet::Util::SUIDManager.gid, @@ -314,7 +314,7 @@ class TestUser < Test::Unit::TestCase def test_groups_list_must_not_contain_commas assert_raise(Puppet::Error) do - Puppet::Type.type(:user).create :name => "luke", :groups => "root,adm" + Puppet::Type.type(:user).new :name => "luke", :groups => "root,adm" end end @@ -326,21 +326,21 @@ class TestUser < Test::Unit::TestCase home = nil ogroup = nil assert_nothing_raised { - user = Puppet::Type.type(:user).create( + user = Puppet::Type.type(:user).new( :name => "pptestu", :home => file, :gid => "pptestg", :groups => "yayness" ) - home = Puppet::Type.type(:file).create( + home = Puppet::Type.type(:file).new( :path => file, :owner => "pptestu", :ensure => "directory" ) - group = Puppet::Type.type(:group).create( + group = Puppet::Type.type(:group).new( :name => "pptestg" ) - ogroup = Puppet::Type.type(:group).create( + ogroup = Puppet::Type.type(:group).new( :name => "yayness" ) comp = mk_catalog(user, group, home, ogroup) @@ -404,7 +404,7 @@ class TestUser < Test::Unit::TestCase # Testing #455 def test_autorequire_with_no_group_should - user = Puppet::Type.type(:user).create(:name => "yaytest", :check => :all) + user = Puppet::Type.type(:user).new(:name => "yaytest", :check => :all) catalog = mk_catalog(user) assert_nothing_raised do @@ -424,7 +424,7 @@ class TestUser < Test::Unit::TestCase # Make sure the 'managehome' param can only be set when the provider # has that feature. Uses a patch from #432. def test_managehome - user = Puppet::Type.type(:user).create(:name => "yaytest", :check => :all) + user = Puppet::Type.type(:user).new(:name => "yaytest", :check => :all) prov = user.provider diff --git a/test/ral/type/yumrepo.rb b/test/ral/type/yumrepo.rb index ae14ce2f8..5ece6c1e0 100755 --- a/test/ral/type/yumrepo.rb +++ b/test/ral/type/yumrepo.rb @@ -80,7 +80,7 @@ class TestYumRepo < Test::Unit::TestCase def make_repo(name, hash={}) hash[:name] = name - Puppet::Type.type(:yumrepo).create(hash) + Puppet::Type.type(:yumrepo).new(hash) end def all_sections(inifile) diff --git a/test/ral/type/zone.rb b/test/ral/type/zone.rb index b951ae61e..59447d74b 100755 --- a/test/ral/type/zone.rb +++ b/test/ral/type/zone.rb @@ -21,7 +21,7 @@ class TestZone < PuppetTest::TestCase File.chmod(0700, base) root = File.join(base, "zonebase") assert_nothing_raised { - zone = Puppet::Type.type(:zone).create( + zone = Puppet::Type.type(:zone).new( :name => name, :path => root, :ensure => "configured" # don't want to install zones automatically @@ -177,7 +177,7 @@ class TestZoneAsRoot < TestZone @@zones.each do |zone| next unless current.include? zone - obj = Puppet::Type.type(:zone).create(:name => zone) + obj = Puppet::Type.type(:zone).new(:name => zone) obj[:ensure] = :absent assert_apply(obj) end diff --git a/test/util/log.rb b/test/util/log.rb index 6b670c2bc..74bb1faa1 100755 --- a/test/util/log.rb +++ b/test/util/log.rb @@ -129,7 +129,7 @@ class TestLog < Test::Unit::TestCase # Verify that the error and source are always strings def test_argsAreStrings msg = nil - file = Puppet::Type.type(:file).create( + file = Puppet::Type.type(:file).new( :path => tempfile(), :check => %w{owner group} ) diff --git a/test/util/storage.rb b/test/util/storage.rb index 11c53a56a..531d1e7e1 100755 --- a/test/util/storage.rb +++ b/test/util/storage.rb @@ -12,7 +12,7 @@ class TestStorage < Test::Unit::TestCase path = tempfile() File.open(path, "w") { |f| f.puts :yayness } - f = Puppet::Type.type(:file).create( + f = Puppet::Type.type(:file).new( :name => path, :check => %w{checksum type} ) @@ -101,7 +101,7 @@ class TestStorage < Test::Unit::TestCase def test_caching hash = nil - one = Puppet::Type.type(:exec).create :title => "/bin/echo one" + one = Puppet::Type.type(:exec).new :title => "/bin/echo one" [one, :yayness].each do |object| assert_nothing_raised do hash = Puppet::Util::Storage.cache(object) |
