added anchor pattern

This commit is contained in:
James Fryman 2011-06-21 12:03:47 -07:00
parent 9c9b5c2c78
commit b9aac9292e
4 changed files with 37 additions and 15 deletions

View file

@ -6,3 +6,5 @@ license 'Apache License Version 2.0'
summary 'Puppet NGINX management module'
description 'This module can be used for basic NGINX Management'
project_page 'http://github.com/puppetlabs/puppetlabs-nginx'
dependency 'puppetlabs/stdlib', '>= 0.1.6'

View file

@ -10,6 +10,7 @@
# Actions:
#
# Requires:
# puppetlabs-stdlib - https://github.com/puppetlabs/puppetlabs-stdlib
#
# Packaged NGINX
# - RHEL: EPEL or custom package
@ -25,15 +26,25 @@
# }
class nginx {
include nginx::package
include nginx::config
include nginx::service
class { 'stdlib': }
Class['nginx::package'] -> Class['nginx::config'] ~> Class['nginx::service']
anchor{ 'nginx::begin':
before => Class['nginx::package'],
notify => Class['nginx::service'],
}
# Allow the end user to establish relationships to the "main" class
# and preserve the relationship to the implementation classes through
# a transitive relationship to the composite class.
Class['nginx::service'] -> Class['nginx']
class { 'nginx::package':
notify => Class['nginx::service'],
}
class { 'nginx::config':
require => Class['nginx::package'],
notify => Class['nginx::service'],
}
class { 'nginx::service': }
anchor { 'nginx::end':
require => Class['nginx::service'],
}
}

View file

@ -14,15 +14,27 @@
#
# This class file is not called directly
class nginx::package {
anchor { 'nginx::package::begin': }
anchor { 'nginx::package::end': }
case $operatingsystem {
centos,fedora,rhel: {
include nginx::package::redhat
class { 'nginx::package::redhat':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
debian,ubuntu: {
include nginx::package::debian
class { 'nginx::package::debian':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
opensuse,suse: {
include nginx::package::suse
class { 'nginx::package::suse':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
}
}

View file

@ -24,8 +24,5 @@ class nginx::service {
enable => true,
hasstatus => true,
hasrestart => true,
subscribe => Class['nginx'],
}
Exec['rebuild-nginx-vhosts'] ~> Service['nginx']
}