diff options
| author | Luke Kanies <luke@madstop.com> | 2005-07-16 16:44:04 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-07-16 16:44:04 +0000 |
| commit | 357afbbc6054dcdc7a1fd5ae468a2e86a44a9bde (patch) | |
| tree | 88ba3c8298ed60a5969ce56f7eb3984e0028e6ff /lib/puppet/transportable.rb | |
| parent | f38bdef90367a0beb9074bbaa4d5fa384660f7a8 (diff) | |
| download | puppet-357afbbc6054dcdc7a1fd5ae468a2e86a44a9bde.tar.gz puppet-357afbbc6054dcdc7a1fd5ae468a2e86a44a9bde.tar.xz puppet-357afbbc6054dcdc7a1fd5ae468a2e86a44a9bde.zip | |
removed type.method() syntax, and replaced it with Type { default => value} syntax -- i still need to add test cases
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@409 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/transportable.rb')
| -rw-r--r-- | lib/puppet/transportable.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb index 0c12a432d..5cfe3d045 100644 --- a/lib/puppet/transportable.rb +++ b/lib/puppet/transportable.rb @@ -51,14 +51,7 @@ module Puppet def to_type retobj = nil if type = Puppet::Type.type(self.type) - begin - # this will fail if the type already exists - # which may or may not be a good thing... - retobj = type.new(self) - rescue => detail - err "Failed to create %s: %s" % [type.name,detail] - return nil - end + retobj = type.new(self) else raise "Could not find object type %s" % self.type end @@ -162,6 +155,10 @@ module Puppet # exists in our scope # this assumes that type/name combinations are globally # unique + + # XXX this still might be wrong, because it doesn't search + # up scopes + # either that, or it's redundant name = [child[:name],child.type].join("--") if nametable.include?(name) @@ -176,7 +173,20 @@ module Puppet } else # the object does not exist yet in our scope # now we have the object instantiated, in our scope - object = child.to_type + begin + object = child.to_type + rescue Puppet::Error => except + Puppet.err "Failed to create %s: %s" % + [child.type,except.message] + if Puppet[:debug] + puts except.stack + end + next + rescue => except + Puppet.err "Failed to create %s %s: %s" % + [child.type,child.inspect,except.message] + next + end nametable[name] = object # this sets the order of the object |
