Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec tests and some minor cleanup #10

Merged
merged 3 commits into from May 22, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Remove embedded line define in favor of the file_line type from stdlib

  • Loading branch information
adamcrews committed Apr 22, 2015
commit ff18beaa4986c48f0da9bdea33c6858dfc5b6b07

This file was deleted.

@@ -41,77 +41,74 @@
# Colin Moller <colin@unixarmy.com>
#
class loggly::syslog_ng (
$customer_token
$customer_token
) inherits loggly {

# Bring the Loggly certificate directory configuration into the current
# Puppet scope so templates have access to it
$cert_dir = $loggly::cert_dir
# Bring the Loggly certificate directory configuration into the current
# Puppet scope so templates have access to it
$cert_dir = $loggly::cert_dir

# Ensure our configuration snippet directory exists before putting
# configuration snippets there
if !defined(File['/etc/syslog-ng/conf.d']){
file { '/etc/syslog-ng/conf.d':
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
}
}
# Ensure we are using the correct source name on each distro
$syslog_source = $::osfamily ? {
'RedHat' => 's_sys',
'Debian' => 's_src',
# Ensure our configuration snippet directory exists before putting
# configuration snippets there
if !defined(File['/etc/syslog-ng/conf.d']){
file { '/etc/syslog-ng/conf.d':
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
}
}
# Ensure we are using the correct source name on each distro
$syslog_source = $::osfamily ? {
'RedHat' => 's_sys',
'Debian' => 's_src',
}

case $::operatingsystem {
centos, redhat: {
# On CentOS/Red Hat, the default syslog-ng configuration does not
# include a configuration snippet directory, so we ensure it
# is present
loggly::utils::line { 'snippet_dir':
ensure => 'present',
line => '@include "/etc/syslog-ng/conf.d/"',
file => '/etc/syslog-ng/syslog-ng.conf',
}

# Add a dependency on the snippet directory configuration so that
# it will be present before generating the configuration snippet
File['/etc/syslog-ng/conf.d/22-loggly.conf'] ->
Loggly::Utils::Line['snippet_dir']

# Packages available from the EPEL repo for syslog-ng on
# CentOS/Red Hat are not compiled with TLS support by default
$enable_tls = false
}
case $::operatingsystem {
centos, redhat: {
# On CentOS/Red Hat, the default syslog-ng configuration does not
# include a configuration snippet directory, so we ensure it is
# present
file_line { 'snippet_dir':
ensure => present,
path => '/etc/syslog-ng/syslog-ng.conf',
line => '@include "/etc/syslog-ng/conf.d/"',
before => File['/etc/syslog-ng/conf.d/22-loggly.conf'],
}

# Respect the default set in the loggly class on other distros
default: {
$enable_tls = $loggly::enable_tls
}
# Packages available from the EPEL repo for syslog-ng on
# CentOS/Red Hat are not compiled with TLS support by default
$enable_tls = false
}

# Emit a configuration snippet that submits events to Loggly by default
file { '/etc/syslog-ng/conf.d/22-loggly.conf':
owner => 'root',
group => 'root',
mode => '0644',
content => template('loggly/syslog-ng/22-loggly.conf.erb'),
require => File['/etc/syslog-ng/conf.d'],
notify => Exec['restart_syslog_ng'],
# Respect the default set in the loggly class on other distros
default: {
$enable_tls = $loggly::enable_tls
}
}

# Call an exec to restart the syslog service instead of using a puppet
# managed service to avoid external dependencies or conflicts with modules
# that may already manage the syslog daemon.
#
# Note that this will only be called on configuration changes due to the
# 'refreshonly' parameter.
exec { 'restart_syslog_ng':
command => 'service syslog-ng restart',
path => [ '/usr/sbin', '/sbin', '/usr/bin/', '/bin', ],
refreshonly => true,
}
# Emit a configuration snippet that submits events to Loggly by default
# This template uses $enable_tls, $customer_token, and $cert_path
file { '/etc/syslog-ng/conf.d/22-loggly.conf':
owner => 'root',
group => 'root',
mode => '0644',
content => template("${module_name}/syslog-ng/22-loggly.conf.erb"),
require => File['/etc/syslog-ng/conf.d'],
notify => Exec['restart_syslog_ng'],
}

# Call an exec to restart the syslog service instead of using a puppet
# managed service to avoid external dependencies or conflicts with
# modules that may already manage the syslog daemon.
#
# Note that this will only be called on configuration changes due to the
# 'refreshonly' parameter.
exec { 'restart_syslog_ng':
command => 'service syslog-ng restart',
path => [ '/usr/sbin', '/sbin', '/usr/bin/', '/bin', ],
refreshonly => true,
}
}

# vi:syntax=puppet:filetype=puppet:ts=4:et:
# vim: syntax=puppet ft=puppet ts=2 sw=2 nowrap et

This file was deleted.

@@ -0,0 +1,37 @@
{
"name": "loggly-loggly",
"version": "1.1.0",
"author": "loggly",
"summary": "Configures various data sources for automatic submission to Loggly",
"license": "Apache-2.0",
"source": "https://github.com/loggly/Loggly-Puppet.git",
"project_page": "https://github.com/loggly/Loggly-Puppet",
"issues_url": "https://github.com/loggly/Loggly-Puppet/issues",
"dependencies": [
{
"name": "puppetlabs-stdlib",
"version_requirement": ">= 4.0.0 < 5.0.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"12.04",
"13.10"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6"
]
},
{
"operatingsystem": "Fedora",
"operatingsystemrelease": [
"19"
]
}
]
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.