From 303efc634d1fc9ee8edc2dab0ae8aa4c6c703c74 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Mon, 7 Oct 2013 16:27:17 +0200 Subject: [PATCH] fixed calling out of scope variables --- manifests/init.pp | 3 +++ manifests/package.pp | 9 ++++++++- manifests/package/debian.pp | 12 ++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 33d5b54..25a2f8a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -60,6 +60,9 @@ class nginx ( include stdlib class { 'nginx::package': + package_name => $package_name, + package_source => $package_source, + package_ensure => $package_ensure, notify => Class['nginx::service'], } diff --git a/manifests/package.pp b/manifests/package.pp index 2af4a0f..7e791fb 100644 --- a/manifests/package.pp +++ b/manifests/package.pp @@ -13,7 +13,11 @@ # Sample Usage: # # This class file is not called directly -class nginx::package { +class nginx::package( + $package_name = 'nginx', + $package_source = 'nginx', + $package_ensure = 'present', +) { anchor { 'nginx::package::begin': } anchor { 'nginx::package::end': } @@ -26,6 +30,9 @@ class nginx::package { } 'debian': { class { 'nginx::package::debian': + package_name => $package_name, + package_source => $package_source, + package_ensure => $package_ensure, require => Anchor['nginx::package::begin'], before => Anchor['nginx::package::end'], } diff --git a/manifests/package/debian.pp b/manifests/package/debian.pp index 0f7aea8..76b9300 100644 --- a/manifests/package/debian.pp +++ b/manifests/package/debian.pp @@ -13,11 +13,15 @@ # Sample Usage: # # This class file is not called directly -class nginx::package::debian { +class nginx::package::debian( + $package_name = 'nginx', + $package_source = 'nginx', + $package_ensure = 'present' + ) { $distro = downcase($::operatingsystem) - package { $nginx::package_name: - ensure => $nginx::package_ensure, + package { $package_name: + ensure => $package_ensure, require => Anchor['nginx::apt_repo'], } @@ -25,7 +29,7 @@ class nginx::package::debian { include '::apt' - case $nginx::package_source { + case $package_source { 'nginx': { apt::source { 'nginx': location => "http://nginx.org/packages/${distro}",