diff --git a/lib/puppet/provider/onetemplate/cli.rb b/lib/puppet/provider/onetemplate/cli.rb index 5c6c49ad..dc1f7942 100644 --- a/lib/puppet/provider/onetemplate/cli.rb +++ b/lib/puppet/provider/onetemplate/cli.rb @@ -71,6 +71,7 @@ def create end if resource[:context] end end + tempfile = builder.to_xml file.write(tempfile) file.close self.debug "Creating template using #{tempfile}" @@ -114,9 +115,8 @@ def self.instances def self.prefetch(resources) templates = instances resources.keys.each do |name| - if provider = templates.find{ |template| template.name == name } - resources[name].provider = provider - end + provider = templates.find { |template| template.name == name } + resources[name].provider = provider unless provider.nil? end end