This method has been superceded by Puppet::Type.parameter
Signed-off-by: Luke Kanies <[email protected]>
---
Local-branch: refactor/master/8233-refactor_parameter_management
lib/puppet/provider.rb | 2 +-
lib/puppet/provider/ldap.rb | 2 +-
lib/puppet/type.rb | 5 ---
spec/unit/provider/ldap_spec.rb | 6 ++--
spec/unit/provider/network_device_spec.rb | 4 +-
spec/unit/type/augeas_spec.rb | 12 ++++----
spec/unit/type/component_spec.rb | 4 +-
spec/unit/type/computer_spec.rb | 12 ++++----
spec/unit/type/cron_spec.rb | 2 +-
spec/unit/type/file/checksum_spec.rb | 2 +-
spec/unit/type/file/content_spec.rb | 4 +-
spec/unit/type/file/ctime.rb | 2 +-
spec/unit/type/file/ensure_spec.rb | 2 +-
spec/unit/type/file/group_spec.rb | 2 +-
spec/unit/type/file/mtime.rb | 2 +-
spec/unit/type/file/owner_spec.rb | 2 +-
spec/unit/type/file/selinux_spec.rb | 2 +-
spec/unit/type/file/source_spec.rb | 4 +-
spec/unit/type/file/type.rb | 2 +-
spec/unit/type/host_spec.rb | 14 +++++-----
spec/unit/type/macauthorization_spec.rb | 20 +++++++-------
spec/unit/type/mcx_spec.rb | 8 +++---
spec/unit/type/nagios_spec.rb | 6 ++--
spec/unit/type/noop_metaparam_spec.rb | 2 +-
spec/unit/type/service_spec.rb | 4 +-
spec/unit/type/tidy_spec.rb | 4 +-
spec/unit/type/user_spec.rb | 42 ++++++++++++++--------------
spec/unit/type/zfs_spec.rb | 4 +-
spec/unit/type/zone_spec.rb | 4 +-
spec/unit/type/zpool_spec.rb | 4 +-
spec/unit/type_spec.rb | 6 ++--
test/ral/manager/attributes.rb | 4 +-
32 files changed, 95 insertions(+), 100 deletions(-)
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index e95613b..86093b6 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -182,7 +182,7 @@ class Puppet::Provider
if param.is_a?(Class)
klass = param
else
- unless klass = resource_type.attrclass(param)
+ unless klass = resource_type.parameter(param)
raise Puppet::DevError, "'#{param}' is not a valid parameter for
#{resource_type.name}"
end
end
diff --git a/lib/puppet/provider/ldap.rb b/lib/puppet/provider/ldap.rb
index b7d6baa..becb753 100644
--- a/lib/puppet/provider/ldap.rb
+++ b/lib/puppet/provider/ldap.rb
@@ -80,7 +80,7 @@ class Puppet::Provider::Ldap < Puppet::Provider
# Skip any attributes we don't manage.
next result unless self.class.resource_type.valid_parameter?(param)
- paramclass = self.class.resource_type.attrclass(param)
+ paramclass = self.class.resource_type.parameter(param)
unless values.is_a?(Array)
result[param] = values
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index b6a4d56..529c664 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -278,11 +278,6 @@ class Type
parameters.find_all { |p| p.property? }
end
- # Find the class associated with any given attribute.
- def self.attrclass(name)
- parameter(name)
- end
-
# What type of parameter are we dealing with? Cache the results, because
# this method gets called so many times.
def self.attrtype(attr)
diff --git a/spec/unit/provider/ldap_spec.rb b/spec/unit/provider/ldap_spec.rb
index 012a22b..597a412 100755
--- a/spec/unit/provider/ldap_spec.rb
+++ b/spec/unit/provider/ldap_spec.rb
@@ -130,7 +130,7 @@ describe Puppet::Provider::Ldap do
@class.stubs(:resource_type).returns @resource_class
@property_class = stub 'property_class', :array_matching => :all,
:superclass => Puppet::Property
- @resource_class.stubs(:attrclass).with(:one).returns(@property_class)
+ @resource_class.stubs(:parameter).with(:one).returns(@property_class)
@resource_class.stubs(:valid_parameter?).returns true
end
@@ -153,7 +153,7 @@ describe Puppet::Provider::Ldap do
it "should only use the first value for attributes that are not
properties" do
# Yay. hackish, but easier than mocking everything.
- @resource_class.expects(:attrclass).with(:a).returns
Puppet::Type.type(:user).attrclass(:name)
+ @resource_class.expects(:parameter).with(:a).returns
Puppet::Type.type(:user).parameter(:name)
@property_class.stubs(:array_matching).returns :all
instance = @class.new(:one => %w{two three}, :a => %w{b c})
@@ -177,7 +177,7 @@ describe Puppet::Provider::Ldap do
@instance = @class.new
@property_class = stub 'property_class', :array_matching => :all,
:superclass => Puppet::Property
- @resource_class = stub 'resource_class', :attrclass => @property_class,
:valid_parameter? => true, :validproperties => [:one, :two]
+ @resource_class = stub 'resource_class', :parameter => @property_class,
:valid_parameter? => true, :validproperties => [:one, :two]
@class.stubs(:resource_type).returns @resource_class
end
diff --git a/spec/unit/provider/network_device_spec.rb
b/spec/unit/provider/network_device_spec.rb
index aae6ad6..ae8627f 100755
--- a/spec/unit/provider/network_device_spec.rb
+++ b/spec/unit/provider/network_device_spec.rb
@@ -73,7 +73,7 @@ describe provider_class do
provider_class.stubs(:resource_type).returns @resource_class
@property_class = stub 'property_class', :array_matching => :all,
:superclass => Puppet::Property
- @resource_class.stubs(:attrclass).with(:one).returns(@property_class)
+ @resource_class.stubs(:parameter).with(:one).returns(@property_class)
@resource_class.stubs(:valid_parameter?).returns true
end
@@ -89,7 +89,7 @@ describe provider_class do
@instance = provider_class.new(:device)
@property_class = stub 'property_class', :array_matching => :all,
:superclass => Puppet::Property
- @resource_class = stub 'resource_class', :attrclass => @property_class,
:valid_parameter? => true, :validproperties => [:description]
+ @resource_class = stub 'resource_class', :parameter => @property_class,
:valid_parameter? => true, :validproperties => [:description]
provider_class.stubs(:resource_type).returns @resource_class
end
diff --git a/spec/unit/type/augeas_spec.rb b/spec/unit/type/augeas_spec.rb
index e80da95..de1779b 100755
--- a/spec/unit/type/augeas_spec.rb
+++ b/spec/unit/type/augeas_spec.rb
@@ -38,21 +38,21 @@ describe augeas do
properties.each do |property|
it "should have a #{property} property" do
- augeas.attrclass(property).ancestors.should
be_include(Puppet::Property)
+ augeas.parameter(property).ancestors.should
be_include(Puppet::Property)
end
it "should have documentation for its #{property} property" do
- augeas.attrclass(property).doc.should be_instance_of(String)
+ augeas.parameter(property).doc.should be_instance_of(String)
end
end
params.each do |param|
it "should have a #{param} parameter" do
- augeas.attrclass(param).ancestors.should be_include(Puppet::Parameter)
+ augeas.parameter(param).ancestors.should be_include(Puppet::Parameter)
end
it "should have documentation for its #{param} parameter" do
- augeas.attrclass(param).doc.should be_instance_of(String)
+ augeas.parameter(param).doc.should be_instance_of(String)
end
end
end
@@ -89,14 +89,14 @@ describe augeas do
it "should return 0 if it does not need to run" do
provider = stub("provider", :need_to_run? => false)
resource = stub('resource', :resource => nil, :provider => provider,
:line => nil, :file => nil)
- changes = augeas.attrclass(:returns).new(:resource => resource)
+ changes = augeas.parameter(:returns).new(:resource => resource)
changes.retrieve.should == 0
end
it "should return :need_to_run if it needs to run" do
provider = stub("provider", :need_to_run? => true)
resource = stub('resource', :resource => nil, :provider => provider,
:line => nil, :file => nil)
- changes = augeas.attrclass(:returns).new(:resource => resource)
+ changes = augeas.parameter(:returns).new(:resource => resource)
changes.retrieve.should == :need_to_run
end
end
diff --git a/spec/unit/type/component_spec.rb b/spec/unit/type/component_spec.rb
index 9d6d719..13f03ce 100755
--- a/spec/unit/type/component_spec.rb
+++ b/spec/unit/type/component_spec.rb
@@ -5,7 +5,7 @@ component = Puppet::Type.type(:component)
describe component do
it "should have a :name attribute" do
- component.attrclass(:name).should_not be_nil
+ component.parameter(:name).should_not be_nil
end
it "should use Class as its type when a normal string is provided as the
title" do
@@ -43,7 +43,7 @@ describe component do
it "should correctly support metaparameters" do
comp = component.new(:name => "Foo[bar]", :require => "Foo[bar]")
- comp.parameter(:require).should
be_instance_of(component.attrclass(:require))
+ comp.parameter(:require).should
be_instance_of(component.parameter(:require))
end
describe "when building up the path" do
diff --git a/spec/unit/type/computer_spec.rb b/spec/unit/type/computer_spec.rb
index 1e15d7a..9e15890 100755
--- a/spec/unit/type/computer_spec.rb
+++ b/spec/unit/type/computer_spec.rb
@@ -15,7 +15,7 @@ describe Puppet::Type.type(:computer), " when checking
computer objects" do
:ip_address => "1.2.3.4")
@properties = {}
- @ensure = Puppet::Type::Computer.attrclass(:ensure).new(:resource =>
@resource)
+ @ensure = Puppet::Type::Computer.parameter(:ensure).new(:resource =>
@resource)
end
it "should be able to create a instance" do
@@ -29,15 +29,15 @@ describe Puppet::Type.type(:computer), " when checking
computer objects" do
properties.each do |property|
it "should have a #{property} property" do
- computer.attrclass(property).ancestors.should
be_include(Puppet::Property)
+ computer.parameter(property).ancestors.should
be_include(Puppet::Property)
end
it "should have documentation for its #{property} property" do
- computer.attrclass(property).doc.should be_instance_of(String)
+ computer.parameter(property).doc.should be_instance_of(String)
end
it "should accept :absent as a value" do
- prop = computer.attrclass(property).new(:resource => @resource)
+ prop = computer.parameter(property).new(:resource => @resource)
prop.should = :absent
prop.should.must == :absent
end
@@ -45,11 +45,11 @@ describe Puppet::Type.type(:computer), " when checking
computer objects" do
params.each do |param|
it "should have a #{param} parameter" do
- computer.attrclass(param).ancestors.should be_include(Puppet::Parameter)
+ computer.parameter(param).ancestors.should be_include(Puppet::Parameter)
end
it "should have documentation for its #{param} parameter" do
- computer.attrclass(param).doc.should be_instance_of(String)
+ computer.parameter(param).doc.should be_instance_of(String)
end
end
diff --git a/spec/unit/type/cron_spec.rb b/spec/unit/type/cron_spec.rb
index 7bf92eb..0fec370 100755
--- a/spec/unit/type/cron_spec.rb
+++ b/spec/unit/type/cron_spec.rb
@@ -37,7 +37,7 @@ describe Puppet::Type.type(:cron) do
[:command, :minute, :hour, :weekday, :month, :monthday].each do |cronparam|
it "should have #{cronparam} of type CronParam" do
- @class.attrclass(cronparam).ancestors.should include CronParam
+ @class.parameter(cronparam).ancestors.should include CronParam
end
end
diff --git a/spec/unit/type/file/checksum_spec.rb
b/spec/unit/type/file/checksum_spec.rb
index b47f617..9147e70 100755
--- a/spec/unit/type/file/checksum_spec.rb
+++ b/spec/unit/type/file/checksum_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-checksum = Puppet::Type.type(:file).attrclass(:checksum)
+checksum = Puppet::Type.type(:file).parameter(:checksum)
describe checksum do
before do
@resource = Puppet::Type.type(:file).new :path => "/foo/bar"
diff --git a/spec/unit/type/file/content_spec.rb
b/spec/unit/type/file/content_spec.rb
index 7af5f9d..e9d9a55 100755
--- a/spec/unit/type/file/content_spec.rb
+++ b/spec/unit/type/file/content_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-content = Puppet::Type.type(:file).attrclass(:content)
+content = Puppet::Type.type(:file).parameter(:content)
describe content do
include PuppetSpec::Files
before do
@@ -380,7 +380,7 @@ describe content do
# recurse => true,
# }
it "when content checksum comes from source" do
- source_param = Puppet::Type.type(:file).attrclass(:source)
+ source_param = Puppet::Type.type(:file).parameter(:source)
source = source_param.new(:resource => @resource)
@content.should = "{md5}123abcd"
diff --git a/spec/unit/type/file/ctime.rb b/spec/unit/type/file/ctime.rb
index 1700d49..9c3b8bd 100755
--- a/spec/unit/type/file/ctime.rb
+++ b/spec/unit/type/file/ctime.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe Puppet::Type.type(:file).attrclass(:ctime) do
+describe Puppet::Type.type(:file).parameter(:ctime) do
require 'puppet_spec/files'
include PuppetSpec::Files
diff --git a/spec/unit/type/file/ensure_spec.rb
b/spec/unit/type/file/ensure_spec.rb
index 8555ef0..0d3e57b 100755
--- a/spec/unit/type/file/ensure_spec.rb
+++ b/spec/unit/type/file/ensure_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-property = Puppet::Type.type(:file).attrclass(:ensure)
+property = Puppet::Type.type(:file).parameter(:ensure)
describe property do
before do
diff --git a/spec/unit/type/file/group_spec.rb
b/spec/unit/type/file/group_spec.rb
index 707a37c..f7e8374 100755
--- a/spec/unit/type/file/group_spec.rb
+++ b/spec/unit/type/file/group_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-property = Puppet::Type.type(:file).attrclass(:group)
+property = Puppet::Type.type(:file).parameter(:group)
describe property do
before do
diff --git a/spec/unit/type/file/mtime.rb b/spec/unit/type/file/mtime.rb
index 3222df0..c61d94b 100755
--- a/spec/unit/type/file/mtime.rb
+++ b/spec/unit/type/file/mtime.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe Puppet::Type.type(:file).attrclass(:mtime) do
+describe Puppet::Type.type(:file).parameter(:mtime) do
require 'puppet_spec/files'
include PuppetSpec::Files
diff --git a/spec/unit/type/file/owner_spec.rb
b/spec/unit/type/file/owner_spec.rb
index ed3bef1..5b3c763 100755
--- a/spec/unit/type/file/owner_spec.rb
+++ b/spec/unit/type/file/owner_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-property = Puppet::Type.type(:file).attrclass(:owner)
+property = Puppet::Type.type(:file).parameter(:owner)
describe property do
before do
diff --git a/spec/unit/type/file/selinux_spec.rb
b/spec/unit/type/file/selinux_spec.rb
index 2622948..5412972 100755
--- a/spec/unit/type/file/selinux_spec.rb
+++ b/spec/unit/type/file/selinux_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
[:seluser, :selrole, :seltype, :selrange].each do |param|
- property = Puppet::Type.type(:file).attrclass(param)
+ property = Puppet::Type.type(:file).parameter(param)
describe property do
before do
@resource = Puppet::Type.type(:file).new :path => "/my/file"
diff --git a/spec/unit/type/file/source_spec.rb
b/spec/unit/type/file/source_spec.rb
index 5665d32..6a6de74 100755
--- a/spec/unit/type/file/source_spec.rb
+++ b/spec/unit/type/file/source_spec.rb
@@ -1,8 +1,8 @@
#!/usr/bin/env rspec
require 'spec_helper'
-source = Puppet::Type.type(:file).attrclass(:source)
-describe Puppet::Type.type(:file).attrclass(:source) do
+source = Puppet::Type.type(:file).parameter(:source)
+describe Puppet::Type.type(:file).parameter(:source) do
before do
# Wow that's a messy interface to the resource.
@resource = stub 'resource', :[]= => nil, :property => nil, :catalog =>
stub("catalog", :dependent_data_expired? => false), :line => 0, :file => ''
diff --git a/spec/unit/type/file/type.rb b/spec/unit/type/file/type.rb
index 7d4af0e..fc7bd76 100755
--- a/spec/unit/type/file/type.rb
+++ b/spec/unit/type/file/type.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe Puppet::Type.type(:file).attrclass(:type) do
+describe Puppet::Type.type(:file).parameter(:type) do
require 'puppet_spec/files'
include PuppetSpec::Files
diff --git a/spec/unit/type/host_spec.rb b/spec/unit/type/host_spec.rb
index 602c428..8c73a82 100755
--- a/spec/unit/type/host_spec.rb
+++ b/spec/unit/type/host_spec.rb
@@ -29,7 +29,7 @@ describe host do
end
it "should have a list host_aliases" do
- @class.attrclass(:host_aliases).ancestors.should
be_include(Puppet::Property::OrderedList)
+ @class.parameter(:host_aliases).ancestors.should
be_include(Puppet::Property::OrderedList)
end
end
@@ -90,38 +90,38 @@ describe host do
describe "when syncing" do
it "should send the first value to the provider for ip property" do
- @ip = @class.attrclass(:ip).new(:resource => @resource, :should =>
%w{192.168.0.1 192.168.0.2})
+ @ip = @class.parameter(:ip).new(:resource => @resource, :should =>
%w{192.168.0.1 192.168.0.2})
@provider.expects(:ip=).with '192.168.0.1'
@ip.sync
end
it "should send the first value to the provider for comment property" do
- @comment = @class.attrclass(:comment).new(:resource => @resource,
:should => %w{Bazinga Notme})
+ @comment = @class.parameter(:comment).new(:resource => @resource,
:should => %w{Bazinga Notme})
@provider.expects(:comment=).with 'Bazinga'
@comment.sync
end
it "should send the joined array to the provider for host_alias" do
- @host_aliases = @class.attrclass(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
+ @host_aliases = @class.parameter(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
@provider.expects(:host_aliases=).with 'foo bar'
@host_aliases.sync
end
it "should also use the specified delimiter for joining" do
- @host_aliases = @class.attrclass(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
+ @host_aliases = @class.parameter(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
@host_aliases.stubs(:delimiter).returns "\t"
@provider.expects(:host_aliases=).with "foo\tbar"
@host_aliases.sync
end
it "should care about the order of host_aliases" do
- @host_aliases = @class.attrclass(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
+ @host_aliases = @class.parameter(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
@host_aliases.insync?(%w{foo bar}).should == true
@host_aliases.insync?(%w{bar foo}).should == false
end
it "should not consider aliases to be in sync if should is a subset of
current" do
- @host_aliases = @class.attrclass(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
+ @host_aliases = @class.parameter(:host_aliases).new(:resource =>
@resource, :should => %w{foo bar})
@host_aliases.insync?(%w{foo bar anotherone}).should == false
end
diff --git a/spec/unit/type/macauthorization_spec.rb
b/spec/unit/type/macauthorization_spec.rb
index 8ab3083..db49a68 100755
--- a/spec/unit/type/macauthorization_spec.rb
+++ b/spec/unit/type/macauthorization_spec.rb
@@ -24,21 +24,21 @@ describe Puppet::Type.type(:macauthorization), "when
checking macauthorization o
parameters.each do |parameter|
it "should have a #{parameter} parameter" do
- macauth_type.attrclass(parameter).ancestors.should
be_include(Puppet::Parameter)
+ macauth_type.parameter(parameter).ancestors.should
be_include(Puppet::Parameter)
end
it "should have documentation for its #{parameter} parameter" do
- macauth_type.attrclass(parameter).doc.should be_instance_of(String)
+ macauth_type.parameter(parameter).doc.should be_instance_of(String)
end
end
properties.each do |property|
it "should have a #{property} property" do
- macauth_type.attrclass(property).ancestors.should
be_include(Puppet::Property)
+ macauth_type.parameter(property).ancestors.should
be_include(Puppet::Property)
end
it "should have documentation for its #{property} property" do
- macauth_type.attrclass(property).doc.should be_instance_of(String)
+ macauth_type.parameter(property).doc.should be_instance_of(String)
end
end
@@ -73,17 +73,17 @@ describe Puppet::Type.type(:macauthorization), "when
checking macauthorization o
[:k_of_n, :timeout, :tries].each do |property|
describe "when managing the #{property} property" do
it "should convert number-looking strings into actual numbers" do
- prop = macauth_type.attrclass(property).new(:resource => @resource)
+ prop = macauth_type.parameter(property).new(:resource => @resource)
prop.should = "300"
prop.should.must == 300
end
it "should support integers as a value" do
- prop = macauth_type.attrclass(property).new(:resource => @resource)
+ prop = macauth_type.parameter(property).new(:resource => @resource)
prop.should = 300
prop.should.must == 300
end
it "should raise an error for non-integer values" do
- prop = macauth_type.attrclass(property).new(:resource => @resource)
+ prop = macauth_type.parameter(property).new(:resource => @resource)
lambda { prop.should = "foo" }.should raise_error(Puppet::Error)
end
end
@@ -92,17 +92,17 @@ describe Puppet::Type.type(:macauthorization), "when
checking macauthorization o
[:allow_root, :authenticate_user, :session_owner, :shared].each do |property|
describe "when managing the #{property} property" do
it "should convert boolean-looking false strings into actual booleans" do
- prop = macauth_type.attrclass(property).new(:resource => @resource)
+ prop = macauth_type.parameter(property).new(:resource => @resource)
prop.should = "false"
prop.should.must == :false
end
it "should convert boolean-looking true strings into actual booleans" do
- prop = macauth_type.attrclass(property).new(:resource => @resource)
+ prop = macauth_type.parameter(property).new(:resource => @resource)
prop.should = "true"
prop.should.must == :true
end
it "should raise an error for non-boolean values" do
- prop = macauth_type.attrclass(property).new(:resource => @resource)
+ prop = macauth_type.parameter(property).new(:resource => @resource)
lambda { prop.should = "foo" }.should raise_error(Puppet::Error)
end
end
diff --git a/spec/unit/type/mcx_spec.rb b/spec/unit/type/mcx_spec.rb
index 02f691a..8706031 100755
--- a/spec/unit/type/mcx_spec.rb
+++ b/spec/unit/type/mcx_spec.rb
@@ -12,19 +12,19 @@ describe mcx_type, "when validating attributes" do
parameters.each do |p|
it "should have a #{p} parameter" do
- mcx_type.attrclass(p).ancestors.should be_include(Puppet::Parameter)
+ mcx_type.parameter(p).ancestors.should be_include(Puppet::Parameter)
end
it "should have documentation for its #{p} parameter" do
- mcx_type.attrclass(p).doc.should be_instance_of(String)
+ mcx_type.parameter(p).doc.should be_instance_of(String)
end
end
properties.each do |p|
it "should have a #{p} property" do
- mcx_type.attrclass(p).ancestors.should be_include(Puppet::Property)
+ mcx_type.parameter(p).ancestors.should be_include(Puppet::Property)
end
it "should have documentation for its #{p} property" do
- mcx_type.attrclass(p).doc.should be_instance_of(String)
+ mcx_type.parameter(p).doc.should be_instance_of(String)
end
end
diff --git a/spec/unit/type/nagios_spec.rb b/spec/unit/type/nagios_spec.rb
index d650723..eafc00c 100755
--- a/spec/unit/type/nagios_spec.rb
+++ b/spec/unit/type/nagios_spec.rb
@@ -27,7 +27,7 @@ describe "Nagios resource types" do
end
it "should have documentation for its #{nagios_type.namevar} parameter"
do
-
puppet_type.attrclass(nagios_type.namevar).instance_variable_get("@doc").should_not
be_nil
+
puppet_type.parameter(nagios_type.namevar).instance_variable_get("@doc").should_not
be_nil
end
it "should have an ensure property" do
@@ -39,7 +39,7 @@ describe "Nagios resource types" do
end
it "should have documentation for its target property" do
-
puppet_type.attrclass(:target).instance_variable_get("@doc").should_not be_nil
+
puppet_type.parameter(:target).instance_variable_get("@doc").should_not be_nil
end
nagios_type.parameters.reject { |param| param == nagios_type.namevar or
param.to_s =~ /^[0-9]/ }.each do |param|
@@ -48,7 +48,7 @@ describe "Nagios resource types" do
end
it "should have documentation for its #{param} property" do
-
puppet_type.attrclass(param).instance_variable_get("@doc").should_not be_nil
+
puppet_type.parameter(param).instance_variable_get("@doc").should_not be_nil
end
end
diff --git a/spec/unit/type/noop_metaparam_spec.rb
b/spec/unit/type/noop_metaparam_spec.rb
index f4241d4..4f6fe3d 100755
--- a/spec/unit/type/noop_metaparam_spec.rb
+++ b/spec/unit/type/noop_metaparam_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
require 'puppet/type'
-describe Puppet::Type.type(:file).attrclass(:noop) do
+describe Puppet::Type.type(:file).parameter(:noop) do
before do
Puppet.settings.stubs(:use)
@file = Puppet::Type.newfile :path => "/what/ever"
diff --git a/spec/unit/type/service_spec.rb b/spec/unit/type/service_spec.rb
index 40270e7..426bc64 100755
--- a/spec/unit/type/service_spec.rb
+++ b/spec/unit/type/service_spec.rb
@@ -79,14 +79,14 @@ describe Puppet::Type.type(:service), "when validating
attribute values" do
it "should allow setting the :enable parameter if the provider has the
:enableable feature" do
Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true)
-
Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(true)
+
Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).parameter(:enable)).returns(true)
svc = Puppet::Type.type(:service).new(:name => "yay", :enable => true)
svc.should(:enable).should == :true
end
it "should not allow setting the :enable parameter if the provider is
missing the :enableable feature" do
Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true)
-
Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(false)
+
Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).parameter(:enable)).returns(false)
svc = Puppet::Type.type(:service).new(:name => "yay", :enable => true)
svc.should(:enable).should be_nil
end
diff --git a/spec/unit/type/tidy_spec.rb b/spec/unit/type/tidy_spec.rb
index cb03063..f7239b9 100755
--- a/spec/unit/type/tidy_spec.rb
+++ b/spec/unit/type/tidy_spec.rb
@@ -23,11 +23,11 @@ describe tidy do
[:age, :size, :path, :matches, :type, :recurse, :rmdirs].each do |param|
it "should have a #{param} parameter" do
- Puppet::Type.type(:tidy).attrclass(param).ancestors.should
be_include(Puppet::Parameter)
+ Puppet::Type.type(:tidy).parameter(param).ancestors.should
be_include(Puppet::Parameter)
end
it "should have documentation for its #{param} param" do
- Puppet::Type.type(:tidy).attrclass(param).doc.should
be_instance_of(String)
+ Puppet::Type.type(:tidy).parameter(param).doc.should
be_instance_of(String)
end
end
diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb
index 71c9e18..caec20b 100755
--- a/spec/unit/type/user_spec.rb
+++ b/spec/unit/type/user_spec.rb
@@ -62,11 +62,11 @@ describe user do
properties.each do |property|
it "should have a #{property} property" do
- user.attrclass(property).ancestors.should be_include(Puppet::Property)
+ user.parameter(property).ancestors.should be_include(Puppet::Property)
end
it "should have documentation for its #{property} property" do
- user.attrclass(property).doc.should be_instance_of(String)
+ user.parameter(property).doc.should be_instance_of(String)
end
end
@@ -74,16 +74,16 @@ describe user do
list_properties.each do |property|
it "should have a list '#{property}'" do
- user.attrclass(property).ancestors.should
be_include(Puppet::Property::List)
+ user.parameter(property).ancestors.should
be_include(Puppet::Property::List)
end
end
it "should have an ordered list 'profiles'" do
- user.attrclass(:profiles).ancestors.should
be_include(Puppet::Property::OrderedList)
+ user.parameter(:profiles).ancestors.should
be_include(Puppet::Property::OrderedList)
end
it "should have key values 'keys'" do
- user.attrclass(:keys).ancestors.should
be_include(Puppet::Property::KeyValue)
+ user.parameter(:keys).ancestors.should
be_include(Puppet::Property::KeyValue)
end
describe "when retrieving all current values" do
@@ -115,7 +115,7 @@ describe user do
describe "when managing the ensure property" do
before do
- @ensure = user.attrclass(:ensure).new(:resource => @resource)
+ @ensure = user.parameter(:ensure).new(:resource => @resource)
end
it "should support a :present value" do
@@ -153,19 +153,19 @@ describe user do
describe "when managing the uid property" do
it "should convert number-looking strings into actual numbers" do
- uid = user.attrclass(:uid).new(:resource => @resource)
+ uid = user.parameter(:uid).new(:resource => @resource)
uid.should = "50"
uid.should.must == 50
end
it "should support UIDs as numbers" do
- uid = user.attrclass(:uid).new(:resource => @resource)
+ uid = user.parameter(:uid).new(:resource => @resource)
uid.should = 50
uid.should.must == 50
end
it "should :absent as a value" do
- uid = user.attrclass(:uid).new(:resource => @resource)
+ uid = user.parameter(:uid).new(:resource => @resource)
uid.should = :absent
uid.should.must == :absent
end
@@ -173,36 +173,36 @@ describe user do
describe "when managing the gid" do
it "should :absent as a value" do
- gid = user.attrclass(:gid).new(:resource => @resource)
+ gid = user.parameter(:gid).new(:resource => @resource)
gid.should = :absent
gid.should.must == :absent
end
it "should convert number-looking strings into actual numbers" do
- gid = user.attrclass(:gid).new(:resource => @resource)
+ gid = user.parameter(:gid).new(:resource => @resource)
gid.should = "50"
gid.should.must == 50
end
it "should support GIDs specified as integers" do
- gid = user.attrclass(:gid).new(:resource => @resource)
+ gid = user.parameter(:gid).new(:resource => @resource)
gid.should = 50
gid.should.must == 50
end
it "should support groups specified by name" do
- gid = user.attrclass(:gid).new(:resource => @resource)
+ gid = user.parameter(:gid).new(:resource => @resource)
gid.should = "foo"
gid.should.must == "foo"
end
describe "when testing whether in sync" do
before do
- @gid = user.attrclass(:gid).new(:resource => @resource, :should =>
%w{foo bar})
+ @gid = user.parameter(:gid).new(:resource => @resource, :should =>
%w{foo bar})
end
it "should return true if no 'should' values are set" do
- @gid = user.attrclass(:gid).new(:resource => @resource)
+ @gid = user.parameter(:gid).new(:resource => @resource)
@gid.must be_safe_insync(500)
end
@@ -224,7 +224,7 @@ describe user do
describe "when syncing" do
before do
- @gid = user.attrclass(:gid).new(:resource => @resource, :should =>
%w{foo bar})
+ @gid = user.parameter(:gid).new(:resource => @resource, :should =>
%w{foo bar})
end
it "should use the first found, specified group as the desired value and
send it to the provider" do
@@ -240,7 +240,7 @@ describe user do
describe "when managing expiry" do
before do
- @expiry = user.attrclass(:expiry).new(:resource => @resource)
+ @expiry = user.parameter(:expiry).new(:resource => @resource)
end
it "should fail if given an invalid date" do
@@ -250,7 +250,7 @@ describe user do
describe "when managing minimum password age" do
before do
- @age = user.attrclass(:password_min_age).new(:resource => @resource)
+ @age = user.parameter(:password_min_age).new(:resource => @resource)
end
it "should accept a negative minimum age" do
@@ -264,7 +264,7 @@ describe user do
describe "when managing maximum password age" do
before do
- @age = user.attrclass(:password_max_age).new(:resource => @resource)
+ @age = user.parameter(:password_max_age).new(:resource => @resource)
end
it "should accept a negative maximum age" do
@@ -278,7 +278,7 @@ describe user do
describe "when managing passwords" do
before do
- @password = user.attrclass(:password).new(:resource => @resource,
:should => "mypass")
+ @password = user.parameter(:password).new(:resource => @resource,
:should => "mypass")
end
it "should not include the password in the change log when adding the
password" do
@@ -305,7 +305,7 @@ describe user do
end
it "should support a :role value for ensure" do
- @ensure = user.attrclass(:ensure).new(:resource => @resource)
+ @ensure = user.parameter(:ensure).new(:resource => @resource)
lambda { @ensure.should = :role }.should_not raise_error
end
end
diff --git a/spec/unit/type/zfs_spec.rb b/spec/unit/type/zfs_spec.rb
index e53c25e..de5068b 100755
--- a/spec/unit/type/zfs_spec.rb
+++ b/spec/unit/type/zfs_spec.rb
@@ -8,7 +8,7 @@ describe zfs do
properties.each do |property|
it "should have a #{property} property" do
- zfs.attrclass(property).ancestors.should be_include(Puppet::Property)
+ zfs.parameter(property).ancestors.should be_include(Puppet::Property)
end
end
@@ -16,7 +16,7 @@ describe zfs do
parameters.each do |parameter|
it "should have a #{parameter} parameter" do
- zfs.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
+ zfs.parameter(parameter).ancestors.should be_include(Puppet::Parameter)
end
end
diff --git a/spec/unit/type/zone_spec.rb b/spec/unit/type/zone_spec.rb
index eb3d33b..1ff64bd 100755
--- a/spec/unit/type/zone_spec.rb
+++ b/spec/unit/type/zone_spec.rb
@@ -16,7 +16,7 @@ describe zone do
parameters.each do |parameter|
it "should have a #{parameter} parameter" do
- zone.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
+ zone.parameter(parameter).ancestors.should be_include(Puppet::Parameter)
end
end
@@ -24,7 +24,7 @@ describe zone do
properties.each do |property|
it "should have a #{property} property" do
- zone.attrclass(property).ancestors.should be_include(Puppet::Property)
+ zone.parameter(property).ancestors.should be_include(Puppet::Property)
end
end
diff --git a/spec/unit/type/zpool_spec.rb b/spec/unit/type/zpool_spec.rb
index 9f18000..d466d6b 100755
--- a/spec/unit/type/zpool_spec.rb
+++ b/spec/unit/type/zpool_spec.rb
@@ -13,7 +13,7 @@ describe zpool do
properties.each do |property|
it "should have a #{property} property" do
- zpool.attrclass(property).ancestors.should be_include(Puppet::Property)
+ zpool.parameter(property).ancestors.should be_include(Puppet::Property)
end
end
@@ -21,7 +21,7 @@ describe zpool do
parameters.each do |parameter|
it "should have a #{parameter} parameter" do
- zpool.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
+ zpool.parameter(parameter).ancestors.should be_include(Puppet::Parameter)
end
end
end
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb
index c3eb8c3..3703832 100755
--- a/spec/unit/type_spec.rb
+++ b/spec/unit/type_spec.rb
@@ -20,17 +20,17 @@ describe Puppet::Type do
it "should be able to retrieve a property by name" do
resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar",
:pass => 1, :ensure => :present)
- resource.property(:fstype).must
be_instance_of(Puppet::Type.type(:mount).attrclass(:fstype))
+ resource.property(:fstype).must
be_instance_of(Puppet::Type.type(:mount).parameter(:fstype))
end
it "should be able to retrieve a parameter by name" do
resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar",
:pass => 1, :ensure => :present)
- resource.parameter(:name).must
be_instance_of(Puppet::Type.type(:mount).attrclass(:name))
+ resource.parameter(:name).must
be_instance_of(Puppet::Type.type(:mount).parameter(:name))
end
it "should be able to retrieve a property by name using the :parameter
method" do
resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar",
:pass => 1, :ensure => :present)
- resource.parameter(:fstype).must
be_instance_of(Puppet::Type.type(:mount).attrclass(:fstype))
+ resource.parameter(:fstype).must
be_instance_of(Puppet::Type.type(:mount).parameter(:fstype))
end
it "should be able to retrieve all set properties" do
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index d01e35a..12d9987 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -91,7 +91,7 @@ class TestTypeAttributes < Test::Unit::TestCase
name = "name#{@num}"
inst = type.new(:name => name)
[:meta, :param, :prop].each do |name|
- klass = type.attrclass(name)
+ klass = type.parameter(name)
assert(klass, "did not get class for #{name}")
obj = yield inst, klass
assert_instance_of(klass, obj, "did not get object back")
@@ -201,7 +201,7 @@ class TestTypeAttributes < Test::Unit::TestCase
# Make sure the 'check' metaparam just ignores non-properties, rather than
failing.
def test_check_allows_parameters
file = Puppet::Type.type(:file)
- klass = file.attrclass(:check)
+ klass = file.parameter(:check)
resource = file.new(:path => tempfile)
inst = klass.new(:resource => resource)
--
1.7.3.1
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.