Thanks for Jim Pirzyk for the patch

Signed-off-by: James Turnbull <[email protected]>
---
 lib/puppet/provider/naginator.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/provider/naginator.rb b/lib/puppet/provider/naginator.rb
index 5c610fb..5dd84cd 100644
--- a/lib/puppet/provider/naginator.rb
+++ b/lib/puppet/provider/naginator.rb
@@ -30,7 +30,15 @@ class Puppet::Provider::Naginator < 
Puppet::Provider::ParsedFile
   end
 
   def self.to_file(records)
-    header + records.collect { |record| record.to_s 
}.join("\n").gsub("_naginator_name", NAME_STRING)
+    header + records.collect { |record|
+        # Remap the TYPE_name or _naginator_name params to the
+        # name if the record is a template (register == 0)
+        if record.to_s =~ /register\s+0/ 
+            record.to_s.sub("_naginator_name", "name").sub(record.type.to_s + 
"_name", "name")
+        else
+            record.to_s.sub("_naginator_name", NAME_STRING)
+        end
+    }.join("\n")
   end
 
   def self.skip_record?(record)
-- 
1.7.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.

Reply via email to