summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-07-15 15:17:10 +0000
committerLuke Kanies <luke@madstop.com>2005-07-15 15:17:10 +0000
commit3d725d9fccb386a22a0a283fb8fc4ed336921f93 (patch)
tree489c5ab7ad5b97c7021550f9cdd3ca03175dd590 /lib/puppet
parentf2b6762c0694cdcab50ca89d791e5cd4843d16a0 (diff)
adding more validation methods
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@403 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/type.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index dfd47f855..fd889ddd3 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -84,7 +84,7 @@ class Type < Puppet::Element
if hash.include?(key)
hash[key]
else
- raise "Object type %s not found" % key
+ raise TypeError.new("Object type %s not found" % key)
end
}
@@ -368,6 +368,19 @@ class Type < Puppet::Element
#---------------------------------------------------------------
#---------------------------------------------------------------
+ def self.validarg?(name)
+ if name.is_a?(String)
+ name = name.intern
+ end
+ if self.validstate?(name) or self.validparameter?(name) or self.metaparam?(name)
+ return true
+ else
+ return false
+ end
+ end
+ #---------------------------------------------------------------
+
+ #---------------------------------------------------------------
# abstract accessing parameters and states, and normalize
# access to always be symbols, not strings
# XXX this returns a _value_, not an object