diff options
author | Luke Kanies <luke@madstop.com> | 2008-12-17 18:10:30 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-12-18 11:10:25 -0600 |
commit | b6db54585177f277b1e06bebd4d925d5c272b610 (patch) | |
tree | ad09cf88c2bd2293bee9a33d88df21734e57b8c3 | |
parent | 89c25ad0661fbc1d57830f4648a3b108f4347278 (diff) | |
download | puppet-b6db54585177f277b1e06bebd4d925d5c272b610.tar.gz puppet-b6db54585177f277b1e06bebd4d925d5c272b610.tar.xz puppet-b6db54585177f277b1e06bebd4d925d5c272b610.zip |
Deprecating 'Puppet.type'; replacing all instances with Puppet::Type.type
Signed-off-by: Luke Kanies <luke@madstop.com>
55 files changed, 194 insertions, 192 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb index ff714e441..dad8936d2 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -366,6 +366,8 @@ module Puppet # Retrieve a type by name. Just proxy to the Type class. def self.type(name) + # LAK:DEP Deprecation notice added 12/17/2008 + Puppet.warning "Puppet.type is deprecated; use Puppet::Type.type" Puppet::Type.type(name) end end diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index 160dab1bb..d50ba7eea 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -512,7 +512,7 @@ class Puppet::Network::Handler # the effort. obj[:check] = CHECKPARAMS else - obj = Puppet.type(:file).create( + obj = Puppet::Type.type(:file).create( :name => file_path(path, client), :check => CHECKPARAMS ) diff --git a/lib/puppet/network/handler/resource.rb b/lib/puppet/network/handler/resource.rb index 7ec27b4dc..e7ecbbdf2 100755 --- a/lib/puppet/network/handler/resource.rb +++ b/lib/puppet/network/handler/resource.rb @@ -59,7 +59,7 @@ class Puppet::Network::Handler Puppet.info "Describing %s[%s]" % [type.to_s.capitalize, name] @local = true unless client typeklass = nil - unless typeklass = Puppet.type(type) + unless typeklass = Puppet::Type.type(type) raise Puppet::Error, "Puppet type %s is unsupported" % type end @@ -124,7 +124,7 @@ class Puppet::Network::Handler def list(type, ignore = [], base = nil, format = "yaml", client = nil, clientip = nil) @local = true unless client typeklass = nil - unless typeklass = Puppet.type(type) + unless typeklass = Puppet::Type.type(type) raise Puppet::Error, "Puppet type %s is unsupported" % type end diff --git a/lib/puppet/provider/package/rug.rb b/lib/puppet/provider/package/rug.rb index 1e1d6763f..b68ec30c5 100644 --- a/lib/puppet/provider/package/rug.rb +++ b/lib/puppet/provider/package/rug.rb @@ -1,4 +1,4 @@ -Puppet.type(:package).provide :rug, :parent => :rpm do +Puppet::Type.type(:package).provide :rug, :parent => :rpm do desc "Support for suse ``rug`` package manager." has_feature :versionable diff --git a/lib/puppet/provider/package/up2date.rb b/lib/puppet/provider/package/up2date.rb index dde633db4..aa7c9eaf0 100644 --- a/lib/puppet/provider/package/up2date.rb +++ b/lib/puppet/provider/package/up2date.rb @@ -1,4 +1,4 @@ -Puppet.type(:package).provide :up2date, :parent => :rpm, :source => :rpm do +Puppet::Type.type(:package).provide :up2date, :parent => :rpm, :source => :rpm do desc "Support for Red Hat's proprietary ``up2date`` package update mechanism." diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 56788a6cf..b708cd591 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1685,7 +1685,7 @@ class Type reqs = [] self.class.eachautorequire { |type, block| # Ignore any types we can't find, although that would be a bit odd. - next unless typeobj = Puppet.type(type) + next unless typeobj = Puppet::Type.type(type) # Retrieve the list of names from the block. next unless list = self.instance_eval(&block) diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 169dc577a..ffcd2b0e8 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -863,7 +863,7 @@ module Puppet end end end - end # Puppet.type(:pfile) + end # Puppet::Type.type(:pfile) # We put all of the properties in separate files, because there are so many # of them. The order these are loaded is important, because it determines diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb index ae7137264..7466c5e3a 100755 --- a/lib/puppet/type/file/ensure.rb +++ b/lib/puppet/type/file/ensure.rb @@ -1,5 +1,5 @@ module Puppet - Puppet.type(:file).ensurable do + Puppet::Type.type(:file).ensurable do require 'etc' desc "Whether to create files that don't currently exist. Possible values are *absent*, *present*, *file*, and *directory*. diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb index 56883add6..3aeac21ff 100755 --- a/lib/puppet/type/file/group.rb +++ b/lib/puppet/type/file/group.rb @@ -2,7 +2,7 @@ require 'puppet/util/posix' # Manage file group ownership. module Puppet - Puppet.type(:file).newproperty(:group) do + Puppet::Type.type(:file).newproperty(:group) do include Puppet::Util::POSIX require 'etc' diff --git a/lib/puppet/type/file/mode.rb b/lib/puppet/type/file/mode.rb index ada1b5b47..fd9c27ae6 100755 --- a/lib/puppet/type/file/mode.rb +++ b/lib/puppet/type/file/mode.rb @@ -2,7 +2,7 @@ # for specification (e.g., u+rwx, or -0011), but for now only supports # specifying the full mode. module Puppet - Puppet.type(:file).newproperty(:mode) do + Puppet::Type.type(:file).newproperty(:mode) do require 'etc' desc "Mode the file should be. Currently relatively limited: you must specify the exact mode the file should be." diff --git a/lib/puppet/type/file/owner.rb b/lib/puppet/type/file/owner.rb index 6bc40ecbd..e4339f05b 100755 --- a/lib/puppet/type/file/owner.rb +++ b/lib/puppet/type/file/owner.rb @@ -1,5 +1,5 @@ module Puppet - Puppet.type(:file).newproperty(:owner) do + Puppet::Type.type(:file).newproperty(:owner) do include Puppet::Util::POSIX include Puppet::Util::Warnings diff --git a/lib/puppet/type/file/selcontext.rb b/lib/puppet/type/file/selcontext.rb index 22e3080b1..8ef51366a 100644 --- a/lib/puppet/type/file/selcontext.rb +++ b/lib/puppet/type/file/selcontext.rb @@ -50,7 +50,7 @@ module Puppet end end - Puppet.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do + Puppet::Type.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do desc "What the SELinux user component of the context of the file should be. Any valid SELinux user component is accepted. For example ``user_u``. If not specified it defaults to the value returned by matchpathcon for @@ -61,7 +61,7 @@ module Puppet defaultto { self.retrieve_default_context(:seluser) } end - Puppet.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do + Puppet::Type.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do desc "What the SELinux role component of the context of the file should be. Any valid SELinux role component is accepted. For example ``role_r``. If not specified it defaults to the value returned by matchpathcon for @@ -72,7 +72,7 @@ module Puppet defaultto { self.retrieve_default_context(:selrole) } end - Puppet.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do + Puppet::Type.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do desc "What the SELinux type component of the context of the file should be. Any valid SELinux type component is accepted. For example ``tmp_t``. If not specified it defaults to the value returned by matchpathcon for @@ -83,7 +83,7 @@ module Puppet defaultto { self.retrieve_default_context(:seltype) } end - Puppet.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do + Puppet::Type.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do desc "What the SELinux range component of the context of the file should be. Any valid SELinux range component is accepted. For example ``s0`` or ``SystemHigh``. If not specified it defaults to the value returned by diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index a6ab5daaf..f7c0fa4fc 100755 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -8,7 +8,7 @@ module Puppet # the file down. If the remote file is a dir or a link or whatever, then # this state, during retrieval, modifies the appropriate other states # so that things get taken care of appropriately. - Puppet.type(:file).newparam(:source) do + Puppet::Type.type(:file).newparam(:source) do include Puppet::Util::Diff attr_accessor :source, :local diff --git a/lib/puppet/type/file/target.rb b/lib/puppet/type/file/target.rb index 8949c2af6..1d85e05bc 100644 --- a/lib/puppet/type/file/target.rb +++ b/lib/puppet/type/file/target.rb @@ -1,5 +1,5 @@ module Puppet - Puppet.type(:file).newproperty(:target) do + Puppet::Type.type(:file).newproperty(:target) do desc "The target for creating a link. Currently, symlinks are the only type supported." diff --git a/lib/puppet/type/file/type.rb b/lib/puppet/type/file/type.rb index 65539795b..1835078a1 100755 --- a/lib/puppet/type/file/type.rb +++ b/lib/puppet/type/file/type.rb @@ -1,5 +1,5 @@ module Puppet - Puppet.type(:file).newproperty(:type) do + Puppet::Type.type(:file).newproperty(:type) do require 'etc' desc "A read-only state to check the file type." diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index 9cf1fa8b4..9ed1bf1c8 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -315,6 +315,6 @@ module Puppet props end end - end # Puppet.type(:package) + end # Puppet::Type.type(:package) end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 47d162547..492dd6136 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -223,7 +223,7 @@ module Puppet groups.each { |group| case group when Integer: - if resource = catalog.resources.find { |r| r.is_a?(Puppet.type(:group)) and r.should(:gid) == group } + if resource = catalog.resources.find { |r| r.is_a?(Puppet::Type.type(:group)) and r.should(:gid) == group } autos << resource end else diff --git a/spec/integration/type/file.rb b/spec/integration/type/file.rb index b6b824008..b331740d6 100755 --- a/spec/integration/type/file.rb +++ b/spec/integration/type/file.rb @@ -234,7 +234,7 @@ describe Puppet::Type.type(:file) do it "should be able to create files when 'content' is specified but 'ensure' is not" do dest = tmpfile("files_with_content") - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :name => dest, :content => "this is some content, yo" ) @@ -249,7 +249,7 @@ describe Puppet::Type.type(:file) do it "should create files with content if both 'content' and 'ensure' are set" do dest = tmpfile("files_with_content") - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :name => dest, :ensure => "file", :content => "this is some content, yo" @@ -268,7 +268,7 @@ describe Puppet::Type.type(:file) do File.open(source, "w") { |f| f.puts "yay" } File.open(dest, "w") { |f| f.puts "boo" } - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :name => dest, :ensure => :absent, :source => source diff --git a/spec/unit/other/selinux.rb b/spec/unit/other/selinux.rb index f024401cb..5e5568377 100644 --- a/spec/unit/other/selinux.rb +++ b/spec/unit/other/selinux.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/type/selboolean' require 'puppet/type/selmodule' -describe Puppet.type(:file), " when manipulating file contexts" do +describe Puppet::Type.type(:file), " when manipulating file contexts" do before :each do @file = Puppet::Type::File.create( :name => "/tmp/foo", @@ -25,7 +25,7 @@ describe Puppet.type(:file), " when manipulating file contexts" do end end -describe Puppet.type(:selboolean), " when manipulating booleans" do +describe Puppet::Type.type(:selboolean), " when manipulating booleans" do before :each do provider_class = Puppet::Type::Selboolean.provider(Puppet::Type::Selboolean.providers[0]) Puppet::Type::Selboolean.expects(:defaultprovider).returns provider_class @@ -54,7 +54,7 @@ describe Puppet.type(:selboolean), " when manipulating booleans" do end end -describe Puppet.type(:selmodule), " when checking policy modules" do +describe Puppet::Type.type(:selmodule), " when checking policy modules" do before :each do provider_class = Puppet::Type::Selmodule.provider(Puppet::Type::Selmodule.providers[0]) Puppet::Type::Selmodule.expects(:defaultprovider).returns provider_class diff --git a/spec/unit/provider/mount/parsed.rb b/spec/unit/provider/mount/parsed.rb index 9585afa62..6168c10d2 100755 --- a/spec/unit/provider/mount/parsed.rb +++ b/spec/unit/provider/mount/parsed.rb @@ -75,7 +75,7 @@ provider_class = Puppet::Type.type(:mount).provider(:parsed) describe provider_class do before :each do - @mount_class = Puppet.type(:mount) + @mount_class = Puppet::Type.type(:mount) @provider_class = @mount_class.provider(:parsed) end diff --git a/spec/unit/provider/ssh_authorized_key/parsed.rb b/spec/unit/provider/ssh_authorized_key/parsed.rb index 21f30f97e..bf0697eb8 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed.rb @@ -13,7 +13,7 @@ describe provider_class do include PuppetTest::FileParsing before :each do - @sshauthkey_class = Puppet.type(:ssh_authorized_key) + @sshauthkey_class = Puppet::Type.type(:ssh_authorized_key) @provider = @sshauthkey_class.provider(:parsed) end diff --git a/spec/unit/type/computer.rb b/spec/unit/type/computer.rb index 43a313c5b..bfb04250b 100755 --- a/spec/unit/type/computer.rb +++ b/spec/unit/type/computer.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' computer = Puppet::Type.type(:computer) -describe Puppet.type(:computer), " when checking computer objects" do +describe Puppet::Type.type(:computer), " when checking computer objects" do before do provider_class = Puppet::Type::Computer.provider(Puppet::Type::Computer.providers[0]) Puppet::Type::Computer.expects(:defaultprovider).returns provider_class diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb index 399181e6c..838a8b663 100755 --- a/spec/unit/type/file.rb +++ b/spec/unit/type/file.rb @@ -101,7 +101,7 @@ describe Puppet::Type.type(:file) do File.open(@file, "w", 0644) { |f| f.puts "yayness"; f.flush } File.symlink(@file, @link) - @resource = Puppet.type(:file).create( + @resource = Puppet::Type.type(:file).create( :path => @link, :mode => "755" ) @@ -128,12 +128,12 @@ describe Puppet::Type.type(:file) do end it "should be able to retrieve a stat instance for the file it is managing" do - Puppet.type(:file).create(:path => "/foo/bar", :source => "/bar/foo").should respond_to(:stat) + Puppet::Type.type(:file).create(:path => "/foo/bar", :source => "/bar/foo").should respond_to(:stat) end describe "when stat'ing its file" do before do - @resource = Puppet.type(:file).create(:path => "/foo/bar") + @resource = Puppet::Type.type(:file).create(:path => "/foo/bar") @resource[:links] = :manage # so we always use :lstat end @@ -197,13 +197,13 @@ describe Puppet::Type.type(:file) do describe "when flushing" do it "should flush all properties that respond to :flush" do - @resource = Puppet.type(:file).create(:path => "/foo/bar", :source => "/bar/foo") + @resource = Puppet::Type.type(:file).create(:path => "/foo/bar", :source => "/bar/foo") @resource.parameter(:source).expects(:flush) @resource.flush end it "should reset its stat reference" do - @resource = Puppet.type(:file).create(:path => "/foo/bar") + @resource = Puppet::Type.type(:file).create(:path => "/foo/bar") File.expects(:lstat).times(2).returns("stat1").then.returns("stat2") @resource.stat.should == "stat1" @resource.flush diff --git a/spec/unit/type/macauthorization.rb b/spec/unit/type/macauthorization.rb index 02967e804..15690d897 100755 --- a/spec/unit/type/macauthorization.rb +++ b/spec/unit/type/macauthorization.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' macauth_type = Puppet::Type.type(:macauthorization) -describe Puppet.type(:macauthorization), "when checking macauthorization objects" do +describe Puppet::Type.type(:macauthorization), "when checking macauthorization objects" do before do authplist = {} diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb index caf932678..6e71ebbcc 100755 --- a/spec/unit/type/user.rb +++ b/spec/unit/type/user.rb @@ -239,11 +239,11 @@ describe user do describe "when user has roles" do it "should autorequire roles" do #this is a little funky because the autorequire depends on a property with a feature - testuser = Puppet.type(:user).create(:name => "testuser") + testuser = Puppet::Type.type(:user).create(:name => "testuser") testuser.provider.class.expects(:feature?).with(:manages_solaris_rbac).returns(true) testuser[:roles] = "testrole" - testrole = Puppet.type(:user).create(:name => "testrole") + testrole = Puppet::Type.type(:user).create(:name => "testrole") config = Puppet::Resource::Catalog.new :testing do |conf| [testuser, testrole].each { |resource| conf.add_resource resource } diff --git a/spec/unit/type/zfs.rb b/spec/unit/type/zfs.rb index f36c715d2..56efa30de 100755 --- a/spec/unit/type/zfs.rb +++ b/spec/unit/type/zfs.rb @@ -25,14 +25,14 @@ describe zfs do provider = mock "provider" provider.stubs(:name).returns(:solaris) zfs.stubs(:defaultprovider).returns(provider) - Puppet.type(:zpool).stubs(:defaultprovider).returns(provider) + Puppet::Type.type(:zpool).stubs(:defaultprovider).returns(provider) - foo_pool = Puppet.type(:zpool).create(:name => "foo") + foo_pool = Puppet::Type.type(:zpool).create(:name => "foo") - foo_bar_zfs = Puppet.type(:zfs).create(:name => "foo/bar") - foo_bar_baz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz") - foo_bar_baz_buz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz/buz") + foo_bar_zfs = Puppet::Type.type(:zfs).create(:name => "foo/bar") + foo_bar_baz_zfs = Puppet::Type.type(:zfs).create(:name => "foo/bar/baz") + foo_bar_baz_buz_zfs = Puppet::Type.type(:zfs).create(:name => "foo/bar/baz/buz") config = Puppet::Resource::Catalog.new :testing do |conf| [foo_pool, foo_bar_zfs, foo_bar_baz_zfs, foo_bar_baz_buz_zfs].each { |resource| conf.add_resource resource } diff --git a/spec/unit/util/storage.rb b/spec/unit/util/storage.rb index b2c350267..04829598e 100755 --- a/spec/unit/util/storage.rb +++ b/spec/unit/util/storage.rb @@ -37,8 +37,8 @@ describe Puppet::Util::Storage do describe "when caching a Puppet::Type" do before(:all) do - @file_test = Puppet.type(:file).create(:name => "/yayness", :check => %w{checksum type}) - @exec_test = Puppet.type(:exec).create(:name => "/bin/ls /yayness") + @file_test = Puppet::Type.type(:file).create(:name => "/yayness", :check => %w{checksum type}) + @exec_test = Puppet::Type.type(:exec).create(:name => "/bin/ls /yayness") end it "should return an empty hash" do diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb index c00d8a132..adc3b09ff 100644 --- a/test/lib/puppettest/support/utils.rb +++ b/test/lib/puppettest/support/utils.rb @@ -29,7 +29,7 @@ module PuppetTest::Support::Utils unless resources.empty? resources.each { |r| config.add_resource r } end - elsif resources[0].is_a?(Puppet.type(:component)) + elsif resources[0].is_a?(Puppet::Type.type(:component)) raise ArgumentError, "resource2config() no longer accpts components" comp = resources.shift comp.delve diff --git a/test/other/events.rb b/test/other/events.rb index 9d6bd2bb7..6e6d52024 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(:file).create( + file = Puppet::Type.type(:file).create( :name => name, :ensure => "file" ) - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :name => name, :ensure => "file" ) - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:file).create( + files << Puppet::Type.type(:file).create( :name => tempfile(), :ensure => "file" ) } fname = tempfile() - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:exec).create( + exec1 = Puppet::Type.type(:exec).create( :title => "one", :name => "echo one >> %s" % file, :path => "/usr/bin:/bin" ) - exec2 = Puppet.type(:exec).create( + exec2 = Puppet::Type.type(:exec).create( :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(:exec).create( + exec3 = Puppet::Type.type(:exec).create( :title => "three", :name => "echo three >> %s" % file, :path => "/usr/bin:/bin", diff --git a/test/other/overrides.rb b/test/other/overrides.rb index b38cb09e8..4053e777d 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(:file).create( + baseobj = Puppet::Type.type(:file).create( :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(:file).create( + subobj = Puppet::Type.type(:file).create( :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(:file).create( + baseobj = Puppet::Type.type(:file).create( :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(:file).create( + children << Puppet::Type.type(:file).create( :path => subdir, :recurse => true, :mode => mode diff --git a/test/other/relationships.rb b/test/other/relationships.rb index 4e666450e..fe71beb7b 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(:file).create( + return Puppet::Type.type(:file).create( :path => tempfile, :check => [:mode, :owner, :group] ) diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 931a4d4d1..0578d9e5d 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -219,13 +219,13 @@ class TestTransactions < Test::Unit::TestCase hash[:name] = tmpfile assert_nothing_raised() { - return Puppet.type(:file).create(hash) + return Puppet::Type.type(:file).create(hash) } end def newexec(file) assert_nothing_raised() { - return Puppet.type(:exec).create( + return Puppet::Type.type(:exec).create( :name => "touch %s" % file, :path => "/bin:/usr/bin:/sbin:/usr/sbin", :returns => 0 @@ -377,17 +377,17 @@ class TestTransactions < Test::Unit::TestCase path = tempfile() file1 = tempfile() file2 = tempfile() - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :path => path, :ensure => "file" ) - exec1 = Puppet.type(:exec).create( + exec1 = Puppet::Type.type(:exec).create( :path => ENV["PATH"], :command => "touch %s" % file1, :refreshonly => true, :subscribe => [:file, path] ) - exec2 = Puppet.type(:exec).create( + exec2 = Puppet::Type.type(:exec).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :path => path, :ensure => "file" ) - exec1 = Puppet.type(:exec).create( + exec1 = Puppet::Type.type(:exec).create( :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(:exec).create( + exec2 = Puppet::Type.type(:exec).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :name => tempfile(), :ensure => "file", :backup => false ) fname = tempfile() - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :name => "touch %s" % fname, :path => "/usr/bin:/bin", :schedule => "monthly", diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 3ff18ebf2..4b50e3d5d 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(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( "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(:group).create( + group = Puppet::Type.type(:group).create( :name => "testing" ) } @@ -110,7 +110,7 @@ class TestType < Test::Unit::TestCase end def test_aliases_are_added_to_catalog - resource = Puppet.type(:file).create( + resource = Puppet::Type.type(:file).create( :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(:file).create( + resource = Puppet::Type.type(:file).create( :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(:file).create( + twoobj = Puppet::Type.type(:file).create( :name => two, :require => [:file, one] ) } assert_nothing_raised { - oneobj = Puppet.type(:file).create( + oneobj = Puppet::Type.type(:file).create( :name => one ) } @@ -170,7 +170,7 @@ class TestType < Test::Unit::TestCase def test_ensuredefault user = nil assert_nothing_raised { - user = Puppet.type(:user).create( + user = Puppet::Type.type(:user).create( :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(:user).create( + user = Puppet::Type.type(:user).create( :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(:user).create( + user = Puppet::Type.type(:user).create( :name => "pptestBC", :comment => "A fake user" ) diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb index baea08132..520d9f7ec 100755 --- a/test/ral/providers/group.rb +++ b/test/ral/providers/group.rb @@ -195,7 +195,7 @@ class TestGroupProvider < Test::Unit::TestCase } assert(!missing?(name), "Group %s is missing" % name) - tests = Puppet.type(:group).validproperties + tests = Puppet::Type.type(:group).validproperties tests.each { |test| if self.respond_to?("attrtest_%s" % test) diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb index 98c3acb2e..60920d05b 100755 --- a/test/ral/providers/host/parsed.rb +++ b/test/ral/providers/host/parsed.rb @@ -13,7 +13,7 @@ class TestParsedHostProvider < Test::Unit::TestCase def setup super - @provider = Puppet.type(:host).provider(:parsed) + @provider = Puppet::Type.type(:host).provider(:parsed) @oldfiletype = @provider.filetype end diff --git a/test/ral/providers/mailalias/aliases.rb b/test/ral/providers/mailalias/aliases.rb index ec8b84684..46dd65ff1 100755 --- a/test/ral/providers/mailalias/aliases.rb +++ b/test/ral/providers/mailalias/aliases.rb @@ -11,7 +11,7 @@ class TestMailaliasAliasesProvider < Test::Unit::TestCase def setup super - @provider = Puppet.type(:mailalias).provider(:aliases) + @provider = Puppet::Type.type(:mailalias).provider(:aliases) @oldfiletype = @provider.filetype diff --git a/test/ral/providers/port/parsed.rb b/test/ral/providers/port/parsed.rb index 01ccd3d8c..d295f04e6 100755 --- a/test/ral/providers/port/parsed.rb +++ b/test/ral/providers/port/parsed.rb @@ -14,7 +14,7 @@ require 'puppettest' # # def setup # super -# @provider = Puppet.type(:port).provider(:parsed) +# @provider = Puppet::Type.type(:port).provider(:parsed) # @oldfiletype = @provider.filetype # end # diff --git a/test/ral/providers/sshkey/parsed.rb b/test/ral/providers/sshkey/parsed.rb index 4f18e6494..d7d083db0 100755 --- a/test/ral/providers/sshkey/parsed.rb +++ b/test/ral/providers/sshkey/parsed.rb @@ -11,7 +11,7 @@ class TestParsedSSHKey < Test::Unit::TestCase def setup super - @provider = Puppet.type(:sshkey).provider(:parsed) + @provider = Puppet::Type.type(:sshkey).provider(:parsed) @oldfiletype = @provider.filetype end diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb index 4df89583b..567c01bbc 100755 --- a/test/ral/providers/user.rb +++ b/test/ral/providers/user.rb @@ -46,7 +46,7 @@ class TestUserProvider < Test::Unit::TestCase end def current?(param, user) - property = Puppet.type(:user).properties.find { |st| + property = Puppet::Type.type(:user).properties.find { |st| st.name == param } @@ -81,7 +81,7 @@ class TestUserProvider < Test::Unit::TestCase end def current?(param, user) - property = Puppet.type(:user).properties.find { |st| + property = Puppet::Type.type(:user).properties.find { |st| st.name == param } @@ -370,7 +370,7 @@ class TestUserProvider < Test::Unit::TestCase 5.times do |i| i += 1 name = "pptstgr%s" % i - tmpgroup = Puppet.type(:group).create( + tmpgroup = Puppet::Type.type(:group).create( :name => name, :gid => max + i ) diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb index 8e3d25350..70ae2d4e8 100755 --- a/test/ral/type/cron.rb +++ b/test/ral/type/cron.rb @@ -37,7 +37,7 @@ class TestCron < Test::Unit::TestCase def cronback tab = nil assert_nothing_raised { - tab = Puppet.type(:cron).filetype.read(@me) + tab = Puppet::Type.type(:cron).filetype.read(@me) } if $? == 0 @@ -157,7 +157,7 @@ class TestCron < Test::Unit::TestCase cron = nil assert(cron = catalog.resource(:cron, name), "Could not retrieve named cron") - assert_instance_of(Puppet.type(:cron), cron) + assert_instance_of(Puppet::Type.type(:cron), cron) end end diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb index 5ccfc2475..1d4d8ddfb 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(:exec).create( + command = Puppet::Type.type(:exec).create( :command => "/bin/echo" ) } @@ -25,7 +25,7 @@ class TestExec < Test::Unit::TestCase command = nil output = nil assert_nothing_raised { - command = Puppet.type(:exec).create( + command = Puppet::Type.type(:exec).create( :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(:exec).create( + command = Puppet::Type.type(:exec).create( :command => "echo" ) } assert_nothing_raised { - command = Puppet.type(:exec).create( + command = Puppet::Type.type(:exec).create( :command => "echo", :path => "/usr/bin:/bin:/usr/sbin:/sbin" ) } assert_nothing_raised { - command = Puppet.type(:exec).create( + command = Puppet::Type.type(:exec).create( :command => "/bin/echo" ) } assert_nothing_raised { - command = Puppet.type(:exec).create( + command = Puppet::Type.type(:exec).create( :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(:exec).create( + command = Puppet::Type.type(:exec).create( :command => "mkdir /this/directory/does/not/exist", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 1 ) } assert_nothing_raised { - command = Puppet.type(:exec).create( + command = Puppet::Type.type(:exec).create( :command => "touch /etc", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 1 ) } assert_nothing_raised { - command = Puppet.type(:exec).create( + command = Puppet::Type.type(:exec).create( :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(:exec).create( + command = Puppet::Type.type(:exec).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :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(:exec).create( + cmd = Puppet::Type.type(:exec).create( :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(:exec).create( + cmd = Puppet::Type.type(:exec).create( :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(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :path => oexe, :source => exe, :mode => 0755 ) - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :path => oexe, :source => exe, :mode => 755 ) basedir = File.dirname(oexe) - baseobj = Puppet.type(:file).create( + baseobj = Puppet::Type.type(:file).create( :path => basedir, :source => exe, :mode => 755 ) - ofile = Puppet.type(:file).create( + ofile = Puppet::Type.type(:file).create( :path => exe, :mode => 755 ) - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :command => oexe, :path => ENV["PATH"], :cwd => basedir ) - cat = Puppet.type(:exec).create( + cat = Puppet::Type.type(:exec).create( :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(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:exec).create(args) + exec = Puppet::Type.type(:exec).create(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(:exec).create( + exec = Puppet::Type.type(:exec).create( :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(:exec).create( + exec = Puppet::Type.type(:exec).create( :title => "mkdir", :path => "/usr/bin:/bin", :creates => basedir, @@ -415,7 +415,7 @@ class TestExec < Test::Unit::TestCase } assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :path => basedir, :recurse => true, :mode => "755", @@ -435,13 +435,13 @@ class TestExec < Test::Unit::TestCase def test_falsevals exec = nil assert_nothing_raised do - exec = Puppet.type(:exec).create( + exec = Puppet::Type.type(:exec).create( :command => "/bin/touch yayness" ) end - Puppet.type(:exec).checks.each do |check| - klass = Puppet.type(:exec).paramclass(check) + Puppet::Type.type(:exec).checks.each do |check| + klass = Puppet::Type.type(:exec).paramclass(check) next if klass.value_collection.values.include? :false assert_raise(Puppet::Error, "Check '%s' did not fail on false" % check) do exec[check] = false @@ -455,7 +455,7 @@ class TestExec < Test::Unit::TestCase file = tempfile() assert_nothing_raised { - exec1 = Puppet.type(:exec).create( + exec1 = Puppet::Type.type(:exec).create( :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(:exec).create( + exec2 = Puppet::Type.type(:exec).create( :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(:exec).create( + exec = Puppet::Type.type(:exec).create( :path => ENV["PATH"], :command => "touch #{file}" ) diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 5d3a9b60b..f452ab728 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(:file).create(hash) + file = Puppet::Type.type(:file).create(hash) } return file end @@ -118,7 +118,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :path => path, :owner => user.name, :ensure => "file", @@ -148,7 +148,7 @@ class TestFile < Test::Unit::TestCase obj = nil assert_nothing_raised { - obj = Puppet.type(:file).create( + obj = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :name => path, :ensure => "directory" ) @@ -365,13 +365,13 @@ class TestFile < Test::Unit::TestCase initstorage assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( param => path, :recurse => true, :checksum => "md5" ) } - comp = Puppet.type(:component).create( + comp = Puppet::Type.type(:component).create( :name => "component" ) comp.push file @@ -412,7 +412,7 @@ class TestFile < Test::Unit::TestCase dir = nil [true, "true", "inf", 50].each do |value| assert_nothing_raised { - dir = Puppet.type(:file).create( + dir = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :name => tmpdir(), :check => :type ) @@ -468,7 +468,7 @@ class TestFile < Test::Unit::TestCase # And then check files assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + dirobj = Puppet::Type.type(:file).create( :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(:file).create( + baseobj = Puppet::Type.type(:file).create( :name => basedir, :ensure => "directory" ) - subobj = Puppet.type(:file).create( + subobj = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :name => subpath, :ensure => "directory", :recurse => true @@ -574,7 +574,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :name => dest, :checksum => "md5", :ensure => "file" @@ -613,7 +613,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :path => tempfile(), :group => "fakegroup" ) @@ -640,7 +640,7 @@ class TestFile < Test::Unit::TestCase def test_modecreation path = tempfile() - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :path => path, :ensure => "file", :mode => "0777" @@ -664,7 +664,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :path => path, :ensure => "file", :content => "some text\n", @@ -749,7 +749,7 @@ class TestFile < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :ensure => path, :path => link ) @@ -802,18 +802,18 @@ class TestFile < Test::Unit::TestCase home = nil ogroup = nil assert_nothing_raised { - user = Puppet.type(:user).create( + user = Puppet::Type.type(:user).create( :name => "pptestu", :home => file, :gid => "pptestg" ) - home = Puppet.type(:file).create( + home = Puppet::Type.type(:file).create( :path => file, :owner => "pptestu", :group => "pptestg", :ensure => "directory" ) - group = Puppet.type(:group).create( + group = Puppet::Type.type(:group).create( :name => "pptestg" ) comp = mk_catalog(user, group, home) diff --git a/test/ral/type/file/target.rb b/test/ral/type/file/target.rb index 4fd5894d7..3806f2a9b 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(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + link = Puppet::Type.type(:file).create( :ensure => source, :path => path, :recurse => true @@ -97,7 +97,7 @@ class TestFileTarget < Test::Unit::TestCase link = nil assert_nothing_raised { - link = Puppet.type(:file).create( + link = Puppet::Type.type(:file).create( :ensure => source, :path => dest, :recurse => true @@ -132,7 +132,7 @@ class TestFileTarget < Test::Unit::TestCase link = nil assert_nothing_raised { - link = Puppet.type(:file).create( + link = Puppet::Type.type(:file).create( :path => dest, :ensure => "source" ) @@ -149,12 +149,12 @@ class TestFileTarget < Test::Unit::TestCase dest = tempfile() resources = [] - resources << Puppet.type(:exec).create( + resources << Puppet::Type.type(:exec).create( :command => "mkdir %s; touch %s/file" % [source, source], :title => "yay", :path => ENV["PATH"] ) - resources << Puppet.type(:file).create( + resources << Puppet::Type.type(:file).create( :ensure => source, :path => dest, :recurse => true, @@ -203,7 +203,7 @@ class TestFileTarget < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :ensure => path, :path => link, :backup => false diff --git a/test/ral/type/filebucket.rb b/test/ral/type/filebucket.rb index 28be67b0c..4931ba5f2 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(:file).create(hash) + file = Puppet::Type.type(:file).create(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(:filebucket).create( + bucket = Puppet::Type.type(:filebucket).create( :name => name, :path => path ) diff --git a/test/ral/type/fileignoresource.rb b/test/ral/type/fileignoresource.rb index 996bca424..b59a8db74 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(:file).create( + tofile = Puppet::Type.type(:file).create( :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(:file).create( + tofile = Puppet::Type.type(:file).create( :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(:file).create( + tofile = Puppet::Type.type(:file).create( :name => topath, :source => frompath, :recurse => true, diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb index 5b66f0e6f..7a08326ea 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(:file).create( + tofile = Puppet::Type.type(:file).create( :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(:file).create( + rootobj = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create( + file = Puppet::Type.type(:file).create( :path => to, :source => from ) @@ -317,7 +317,7 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :name => to, :source => files ) @@ -343,7 +343,7 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :name => dest, :source => source ) @@ -364,7 +364,7 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - file = Puppet.type(:file).create( + file = Puppet::Type.type(:file).create( :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(:file).create(:name => dest, :source => link) + file = Puppet::Type.type(:file).create(:name => dest, :source => link) catalog = mk_catalog(file) diff --git a/test/ral/type/group.rb b/test/ral/type/group.rb index 3c29fe505..072c0e9aa 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(:group).create(hash) + group = Puppet::Type.type(:group).create(hash) } return group @@ -115,7 +115,7 @@ class TestGroup < Test::Unit::TestCase gobj = nil comp = nil assert_nothing_raised { - gobj = Puppet.type(:group).create( + gobj = Puppet::Type.type(:group).create( :name => group, :check => [:gid] ) @@ -139,7 +139,7 @@ class TestGroup < Test::Unit::TestCase name = "pptestgr" assert_nothing_raised { - gobj = Puppet.type(:group).create( + gobj = Puppet::Type.type(:group).create( :name => name, :gid => 123 ) @@ -151,7 +151,7 @@ class TestGroup < Test::Unit::TestCase assert(gobj.provider.exists?, "Did not create group") - tests = Puppet.type(:group).validproperties + tests = Puppet::Type.type(:group).validproperties gobj.retrieve tests.each { |test| diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb index df7cc508f..168bb6fd5 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(:host).create( + host = Puppet::Type.type(:host).create( :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(:host).create( + host = Puppet::Type.type(:host).create( :name => "culain", :ip => "192.168.0.3" ) diff --git a/test/ral/type/port.rb b/test/ral/type/port.rb index e28904d55..d41799aac 100755 --- a/test/ral/type/port.rb +++ b/test/ral/type/port.rb @@ -11,7 +11,7 @@ require 'puppettest' # # def setup # super -# @porttype = Puppet.type(:port) +# @porttype = Puppet::Type.type(:port) # # @provider = @porttype.defaultprovider # @@ -40,7 +40,7 @@ require 'puppettest' # @pcount = 1 # end # assert_nothing_raised { -# port = Puppet.type(:port).create( +# port = Puppet::Type.type(:port).create( # :name => "puppet%s" % @pcount, # :number => "813%s" % @pcount, # :protocols => "tcp", @@ -54,7 +54,7 @@ require 'puppettest' # # def test_list # assert_nothing_raised { -# Puppet.type(:port).list +# Puppet::Type.type(:port).list # } # # count = 0 diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb index 46c9f92de..3bd6f343b 100755 --- a/test/ral/type/sshkey.rb +++ b/test/ral/type/sshkey.rb @@ -10,7 +10,7 @@ class TestSSHKey < Test::Unit::TestCase def setup super # god i'm lazy - @sshkeytype = Puppet.type(:sshkey) + @sshkeytype = Puppet::Type.type(:sshkey) @provider = @sshkeytype.defaultprovider @@ -64,7 +64,7 @@ class TestSSHKey < Test::Unit::TestCase def test_instances list = nil assert_nothing_raised { - list = Puppet.type(:sshkey).instances + list = Puppet::Type.type(:sshkey).instances } count = 0 diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb index e2629f703..8f42c7120 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(:user).create( + user = Puppet::Type.type(:user).create( :name => name, :comment => "Puppet Testing User", :gid => Puppet::Util::SUIDManager.gid, @@ -326,21 +326,21 @@ class TestUser < Test::Unit::TestCase home = nil ogroup = nil assert_nothing_raised { - user = Puppet.type(:user).create( + user = Puppet::Type.type(:user).create( :name => "pptestu", :home => file, :gid => "pptestg", :groups => "yayness" ) - home = Puppet.type(:file).create( + home = Puppet::Type.type(:file).create( :path => file, :owner => "pptestu", :ensure => "directory" ) - group = Puppet.type(:group).create( + group = Puppet::Type.type(:group).create( :name => "pptestg" ) - ogroup = Puppet.type(:group).create( + ogroup = Puppet::Type.type(:group).create( :name => "yayness" ) comp = mk_catalog(user, group, home, ogroup) @@ -388,7 +388,7 @@ class TestUser < Test::Unit::TestCase assert_equal("Puppet Testing User", user.provider.comment, "Comment was not set") - tests = Puppet.type(:user).validproperties + tests = Puppet::Type.type(:user).validproperties tests.each { |test| if self.respond_to?("attrtest_%s" % test) diff --git a/test/ral/type/yumrepo.rb b/test/ral/type/yumrepo.rb index a42fa9058..ae14ce2f8 100755 --- a/test/ral/type/yumrepo.rb +++ b/test/ral/type/yumrepo.rb @@ -16,10 +16,10 @@ class TestYumRepo < Test::Unit::TestCase File.open(@yumconf, "w") do |f| f.print "[main]\nreposdir=#{@yumdir} /no/such/dir\n" end - Puppet.type(:yumrepo).yumconf = @yumconf + Puppet::Type.type(:yumrepo).yumconf = @yumconf # It needs to be reset each time, otherwise the cache is used. - Puppet.type(:yumrepo).inifile = nil + Puppet::Type.type(:yumrepo).inifile = nil end # Modify one existing section @@ -33,7 +33,7 @@ class TestYumRepo < Test::Unit::TestCase assert_equal('New description', devel.property(:descr).should) assert_apply(devel) - inifile = Puppet.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read() assert_equal('New description', inifile['development']['name']) assert_equal('Fedora Core $releasever - $basearch - Base', inifile['base']['name']) assert_equal("foo\n bar\n baz", inifile['base']['exclude']) @@ -56,7 +56,7 @@ class TestYumRepo < Test::Unit::TestCase repo = make_repo("base", values) assert_apply(repo) - inifile = Puppet.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read() sections = all_sections(inifile) assert_equal(['base', 'main'], sections) text = inifile["base"].format @@ -72,7 +72,7 @@ class TestYumRepo < Test::Unit::TestCase :baseurl => baseurl }) devel.retrieve assert_apply(devel) - inifile = Puppet.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read() sec = inifile["development"] assert_nil(sec["mirrorlist"]) assert_equal(baseurl, sec["baseurl"]) @@ -80,7 +80,7 @@ class TestYumRepo < Test::Unit::TestCase def make_repo(name, hash={}) hash[:name] = name - Puppet.type(:yumrepo).create(hash) + Puppet::Type.type(:yumrepo).create(hash) end def all_sections(inifile) diff --git a/test/util/log.rb b/test/util/log.rb index 8c7703cb9..6b670c2bc 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(:file).create( + file = Puppet::Type.type(:file).create( :path => tempfile(), :check => %w{owner group} ) diff --git a/test/util/metrics.rb b/test/util/metrics.rb index b0ac1e2f5..b3219fc1a 100755 --- a/test/util/metrics.rb +++ b/test/util/metrics.rb @@ -17,7 +17,7 @@ class TestMetric < PuppetTest::TestCase eventmax = 10 maxdiff = 10 - types = [Puppet.type(:file), Puppet.type(:package), Puppet.type(:package)] + types = [Puppet::Type.type(:file), Puppet::Type.type(:package), Puppet::Type.type(:package)] data = [:total, :managed, :outofsync, :changed, :totalchanges] events = [:file_changed, :package_installed, :service_started] diff --git a/test/util/storage.rb b/test/util/storage.rb index 5634a94f6..11c53a56a 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(:file).create( + f = Puppet::Type.type(:file).create( :name => path, :check => %w{checksum type} ) |