Skip to content
Browse files

Puppet-Lint-I-Fied apache module: Fix quoting and various other fixes

  • Loading branch information...
1 parent 31ab4a5 commit b31daae4ca3995b7f76bfe583079eb281c1f4f08 @vStone vStone committed Jan 19, 2012
Showing with 86 additions and 63 deletions.
  1. +16 −13 manifests/config.pp
  2. +10 −4 manifests/install.pp
  3. +10 −10 manifests/params.pp
  4. +15 −12 manifests/service.pp
  5. +14 −8 manifests/site.pp
  6. +21 −16 manifests/ssl.pp
View
29 manifests/config.pp
@@ -1,26 +1,29 @@
class apache::config {
- group { $apache::params::group: ensure => present, require => Class["apache::install"] }
+ group { $apache::params::group:
+ ensure => present,
+ require => Class['apache::install']
+ }
user { $apache::params::user:
ensure => present,
home => $apache::params::home,
managehome => false,
- membership => minimum,
+ membership => 'minimum',
groups => [],
- shell => "/sbin/nologin",
+ shell => '/sbin/nologin',
require => Group[$apache::params::group],
}
- file{
- "$apache::params::configdir/$apache::params::conffile":
- mode => 0644,
- notify => Exec["reload-apache"],
- require => Class["apache::install"];
- "$apache::params::configdir/":
- ensure => directory,
- mode => 0644,
- notify => Exec["reload-apache"],
- require => Class["apache::install"],
+ file{ "${apache::params::configdir}/${apache::params::conffile}":
+ mode => '0644',
+ notify => Exec['reload-apache'],
+ require => Class['apache::install'],
+ }
+ file { $apache::params::configdir:
+ ensure => directory,
+ mode => '0644',
+ notify => Exec['reload-apache'],
+ require => Class['apache::install'],
}
}
View
14 manifests/install.pp
@@ -1,8 +1,14 @@
class apache::install {
- case $operatingsystem {
- redhat,centos,fedora,Scientific: { $http_package = "httpd" }
- Debian,Ubuntu: { $http_package = "apache2" }
- default: { fail("${hostname}: This module does not support operatingsystem $operatingsystem") }
+ case $::operatingsystem {
+ redhat,centos,fedora,Scientific: {
+ $http_package = 'httpd'
+ }
+ Debian,Ubuntu: {
+ $http_package = 'apache2'
+ }
+ default: {
+ fail("${::hostname}: This module does not support operatingsystem ${::operatingsystem}")
+ }
}
package { $http_package:
View
20 manifests/params.pp
@@ -1,19 +1,19 @@
class apache::params {
- case $operatingsystem {
+ case $::operatingsystem {
Debian,Ubuntu: {
- $user = "www-data"
- $group = "www-data"
- $configdir = "/etc/apache2/conf.d"
- $conffile = "apache2.conf"
+ $user = 'www-data'
+ $group = 'www-data'
+ $configdir = '/etc/apache2/conf.d'
+ $conffile = 'apache2.conf'
}
default: {
- $user = "apache"
- $group = "apache"
- $configdir = "/etc/httpd/conf.d"
- $conffile = "httpd.conf"
+ $user = 'apache'
+ $group = 'apache'
+ $configdir = '/etc/httpd/conf.d'
+ $conffile = 'httpd.conf'
}
}
- $home = "/var/www"
+ $home = '/var/www'
}
View
27 manifests/service.pp
@@ -1,19 +1,22 @@
class apache::service {
- $http_service = $operatingsystem ? {
- /(Debian|Ubuntu)/ => "apache2",
- default => "httpd",
+ $http_service = $::operatingsystem ? {
+ /(Debian|Ubuntu)/ => 'apache2',
+ default => 'httpd',
}
- service { "$http_service":
- ensure => running, enable => true, hasstatus => true, hasrestart => true,
- alias => "httpd",
- subscribe => Package["httpd"]
- }
+ service { $http_service:
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ hasrestart => true,
+ alias => 'httpd',
+ subscribe => Package['httpd']
+ }
- exec { "reload-apache":
- command => "/etc/init.d/$http_service reload",
- onlyif => "/usr/sbin/apachectl -t",
- require => Service["httpd"],
+ exec { 'reload-apache':
+ command => "/etc/init.d/${http_service} reload",
+ onlyif => '/usr/sbin/apachectl -t',
+ require => Service['httpd'],
refreshonly => true,
}
View
22 manifests/site.pp
@@ -1,12 +1,18 @@
-define apache::site( $admin = "webmaster", $aliases = '', $docroot, $ensure = 'present', $rails = false) {
+define apache::site(
+ $docroot,
+ $ensure = 'present',
+ $admin = 'webmaster',
+ $aliases = '',
+ $rails = false
+) {
if $rails { include passenger }
- file { "$apache::params::configdir/$name.conf":
- mode => "644",
- ensure => $ensure,
- require => Package["httpd"],
- notify => Exec["reload-apache"],
- content => template("apache/vhost.conf"),
- }
+ file { "${apache::params::configdir}/${name}.conf":
+ ensure => $ensure,
+ mode => '0644',
+ require => Package['httpd'],
+ notify => Exec['reload-apache'],
+ content => template('apache/vhost.conf'),
+ }
}
View
37 manifests/ssl.pp
@@ -1,28 +1,33 @@
class apache::ssl {
include apache
- case $operatingsystem {
+ case $::operatingsystem {
Debian,Ubuntu: {
- exec { "enable-ssl":
- command => "/usr/sbin/a2enmod ssl",
- creates => "/etc/apache2/mods-enabled/ssl.load",
- notify => Service["httpd"],
- require => Class["apache::install"],
+ exec { 'enable-ssl':
+ command => '/usr/sbin/a2enmod ssl',
+ creates => '/etc/apache2/mods-enabled/ssl.load',
+ notify => Service['httpd'],
+ require => Class['apache::install'],
}
}
default: {
- package { "mod_ssl":
- ensure => present, require => Package["httpd"],
- notify => Class["apache::service"],
+ package { 'mod_ssl':
+ ensure => present,
+ require => Package['httpd'],
+ notify => Class['apache::service'],
}
- file {
- "$apache::params::configdir/ssl.conf":
- mode => 0644, owner => root, group => root,
- notify => Exec["reload-apache"];
- ["/var/cache/mod_ssl", "/var/cache/mod_ssl/scache"]:
+ file { "${apache::params::configdir}/ssl.conf":
+ mode => '0644',
+ owner => 'root',
+ group => 'root',
+ notify => Exec['reload-apache'],
+ }
+ file {['/var/cache/mod_ssl', '/var/cache/mod_ssl/scache']:
ensure => directory,
- owner => apache, group => root, mode => 0700,
- notify => Exec["reload-apache"];
+ owner => 'apache',
+ group => 'root',
+ mode => '0700',
+ notify => Exec['reload-apache'];
}
}
}

0 comments on commit b31daae

Please sign in to comment.
Something went wrong with that request. Please try again.