[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

James Turnbull james at lovedthanlost.net
Wed Apr 8 21:48:10 UTC 2009


The following commit has been merged in the master branch:
commit 70ea39af65f7e56ce151c9f9ca444261d0332454
Author: Luke Kanies <luke at madstop.com>
Date:   Thu Feb 12 16:00:29 2009 -0600

    Adding a post-processor for Nagios names.
    
    This is a brutal hack until Puppet correctly supports
    multiple primary keys.  It basically just comments out
    _naginator_name before writing to disk, and uncomments
    it when reading.  This allows Puppet to use it
    while Nagios ignores it.
    
    Yes, a stupid hack, but it appears to work.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/provider/naginator.rb b/lib/puppet/provider/naginator.rb
index 233d82e..5510eb9 100644
--- a/lib/puppet/provider/naginator.rb
+++ b/lib/puppet/provider/naginator.rb
@@ -7,6 +7,7 @@ require 'puppet/external/nagios'
 
 # The base class for all Naginator providers.
 class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
+    NAME_STRING = "## --PUPPET_NAME-- (called '_naginator_name' in the manifest)"
     # Retrieve the associated class from Nagios::Base.
     def self.nagios_type
         unless defined?(@nagios_type) and @nagios_type
@@ -24,14 +25,14 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
 
     def self.parse(text)
         begin
-            Nagios::Parser.new.parse(text)
+            Nagios::Parser.new.parse(text.gsub(NAME_STRING, "_naginator_name"))
         rescue => detail
             raise Puppet::Error, "Could not parse configuration for %s: %s" % [resource_type.name, detail]
         end
     end
 
     def self.to_file(records)
-        header + records.collect { |record| record.to_s }.join("\n")
+        header + records.collect { |record| record.to_s }.join("\n").gsub("_naginator_name", NAME_STRING)
     end
 
     def self.skip_record?(record)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list