Puppet: System Administration Automated

Support

Ticket #745 (reopened enhancement)

Opened 1 year ago

Last modified 7 months ago

Syslog type support

Reported by: devdas Assigned to: luke
Priority: normal Milestone:
Component: newfeature Version:
Severity: normal Keywords: Syslog
Cc: Triage Stage: Accepted
Attached Patches: Insufficient Complexity: Unknown

Description

Attached files for syslog type, needs tests written.

Attachments

syslog.rb (0.6 kB) - added by devdas on 08/01/07 16:50:54.
basic-syslog-tests.patch (1.5 kB) - added by luke on 08/05/07 21:11:02.
Some simple tests for the syslog type
syslog.diff (2.7 kB) - added by devdas on 08/07/07 16:32:20.
parsed.rb (1.3 kB) - added by devdas on 11/26/07 11:41:46.

Change History

08/01/07 16:50:54 changed by devdas

  • attachment syslog.rb added.

08/05/07 21:05:09 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Added in [2748].

It's easier if the files are provided as a single patch, btw.

08/05/07 21:11:02 changed by luke

  • attachment basic-syslog-tests.patch added.

Some simple tests for the syslog type

08/05/07 21:12:49 changed by luke

  • status changed from closed to reopened.
  • resolution deleted.

Hmmm, I added basic tests to this type, and it looks like the code needs some more work. I've removed it (in 2749], at least until these tests pass.

08/05/07 21:13:00 changed by luke

  • stage changed from Unreviewed to Accepted.
  • patch changed from Code to Insufficient.

08/07/07 16:32:20 changed by devdas

  • attachment syslog.diff added.

11/24/07 05:59:43 changed by luke

What about the tests I provided? Have you updated those and do they pass now?

(follow-up: ↓ 6 ) 11/26/07 11:37:48 changed by devdas

# I am stuck with this bit: # This writes one element of the syslog configuration file properly # but does not deal well with multiple elements. # provider/syslog/parsed.rb

require 'puppet/provider/parsedfile'

# The default target # We should be able to override this by setting it explicitly in Facter syslogfile = nil case Facter.value(:syslogfile) when nil:

syslogconf = '/etc/syslog.conf'

else

syslogconf = Facter.value(:syslogfile)

end

Puppet::Type.type(:syslog).provide(:parsed,

:parent => Puppet::Provider::Parsed File?, :default_target => syslogconf, :filetype => :flat

) do

text_line :comment, :match => /#/ text_line :blank, :match => /\s+/

syslog = record_line :parsed,:fields => %w{facility priority destination},

:match => %r{(\w+)\.(\w+)\s+(.+)$}

class << syslog

def to_line(record)

Puppet.debug "Record in to_line is %s.%s\t\t\t\%s" % [record[:facility], record[:priority], record[:destination]] str = "" str += record[:facility] + '.' + record[:priority] + "\t\t\t" + record[:destination] + "\n"

end

def process(record)

# Puppet.debug "record in process is %s" %record

syslog = [] source, destination = record.split(/\s+/) source.split(/;/).each do |logger|

facility, priority = logger.split(/\./) log_record = {

:facility => facility, :priority => priority, :destination => destination,

} syslog << log_record

Puppet.debug "Key in process is %s %s and %s" % [syslog[0][:facility], syslog[0][:priority], syslog[0][:destination]] end

end

end

end

(in reply to: ↑ 5 ) 11/26/07 11:41:30 changed by devdas

Replying to devdas: Ugh, ignore that. Attaching file.

11/26/07 11:41:46 changed by devdas

  • attachment parsed.rb added.

04/24/08 07:53:46 changed by luke

  • component changed from library to unknown.

04/28/08 16:34:03 changed by jamtur01

  • component changed from unknown to newfeature.