summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails/host.rb
diff options
context:
space:
mode:
authorshadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-15 21:10:22 +0000
committershadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-15 21:10:22 +0000
commitf622e18eff86d7a65e47cb6fd3ac07cceb5b3ecb (patch)
tree94c98e6848e2cc419908af1993c63e08089300b3 /lib/puppet/rails/host.rb
parent9ad62d24093563e947d846fa3771bcebf550b8ee (diff)
downloadpuppet-f622e18eff86d7a65e47cb6fd3ac07cceb5b3ecb.tar.gz
puppet-f622e18eff86d7a65e47cb6fd3ac07cceb5b3ecb.tar.xz
puppet-f622e18eff86d7a65e47cb6fd3ac07cceb5b3ecb.zip
Go back to restype and remove STI classes, they were more trouble than they were worth.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1940 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails/host.rb')
-rw-r--r--lib/puppet/rails/host.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb
index 55b33621a..fd0642722 100644
--- a/lib/puppet/rails/host.rb
+++ b/lib/puppet/rails/host.rb
@@ -64,26 +64,15 @@ class Puppet::Rails::Host < ActiveRecord::Base
raise ArgumentError, "You must pass resources"
end
- typenames = []
- Puppet::Type.loadall
- Puppet::Type.eachtype do |type|
- typenames << type.name.to_s
- end
-
Puppet::Util.benchmark(:info, "Converted resources") do
hash[:resources].each do |resource|
resargs = resource.to_hash.stringify_keys
-
- if typenames.include?(resource.type)
- rtype = "Puppet#{resource.type.to_s.capitalize}"
- end
-
if create
- res = host.resources.find_or_create_by_type_and_title(rtype, resource[:title])
+ res = host.resources.find_or_create_by_restype_and_title(resource[:type], resource[:title])
else
- unless res = host.resources.find_by_type_and_title(rtype, resource[:title])
- res = host.resources.new(:type => rtype, :title => resource[:title])
+ unless res = host.resources.find_by_restype_and_title(resource[:type], resource[:title])
+ res = host.resources.new(:restype => resource[:type], :title => resource[:title])
host.resources << res
end
end