diff --git a/manifests/resource/geo.pp b/manifests/resource/geo.pp index f215785f8..0c85324ef 100644 --- a/manifests/resource/geo.pp +++ b/manifests/resource/geo.pp @@ -63,6 +63,10 @@ Optional[Boolean] $proxy_recursive = undef ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + $root_group = $::nginx::root_group $conf_dir = "${::nginx::conf_dir}/conf.d" diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 8ed298a0c..910ca5de0 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -214,6 +214,10 @@ Optional[String] $expires = undef, ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + $root_group = $::nginx::root_group File { diff --git a/manifests/resource/mailhost.pp b/manifests/resource/mailhost.pp index 7b66546f8..3ea35c47a 100644 --- a/manifests/resource/mailhost.pp +++ b/manifests/resource/mailhost.pp @@ -118,6 +118,10 @@ Array $server_name = [$name] ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + $root_group = $::nginx::root_group File { diff --git a/manifests/resource/map.pp b/manifests/resource/map.pp index 583191437..2cae672c6 100644 --- a/manifests/resource/map.pp +++ b/manifests/resource/map.pp @@ -69,6 +69,10 @@ Enum['absent', 'present'] $ensure = 'present', Boolean $hostnames = false ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + validate_re($string, '^.{2,}$', "Invalid string value [${string}]. Expected a minimum of 2 characters.") diff --git a/manifests/resource/server.pp b/manifests/resource/server.pp index 4a2c6d297..17aec7b12 100644 --- a/manifests/resource/server.pp +++ b/manifests/resource/server.pp @@ -249,6 +249,10 @@ Hash $locations = {} ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + # Variables if $::nginx::confd_only { $server_dir = "${::nginx::conf_dir}/conf.d" diff --git a/manifests/resource/streamhost.pp b/manifests/resource/streamhost.pp index 3662fe340..23e9292d0 100644 --- a/manifests/resource/streamhost.pp +++ b/manifests/resource/streamhost.pp @@ -66,6 +66,10 @@ String $mode = $::nginx::global_mode, ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + # Variables if $::nginx::confd_only { $streamhost_dir = "${::nginx::conf_dir}/conf.stream.d" diff --git a/manifests/resource/upstream.pp b/manifests/resource/upstream.pp index 301a54578..926303920 100644 --- a/manifests/resource/upstream.pp +++ b/manifests/resource/upstream.pp @@ -51,6 +51,10 @@ Enum['http', 'stream'] $upstream_context = 'http', ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } + $root_group = $::nginx::root_group $ensure_real = $ensure ? { diff --git a/manifests/resource/upstream/member.pp b/manifests/resource/upstream/member.pp index d372c07c0..2af034c8f 100644 --- a/manifests/resource/upstream/member.pp +++ b/manifests/resource/upstream/member.pp @@ -41,6 +41,9 @@ Integer $port = 80, $upstream_fail_timeout = '10s', ) { + if ! defined(Class['nginx']) { + fail('You must include the nginx base class before using any defined resources') + } # Uses: $server, $port, $upstream_fail_timeout concat::fragment { "${upstream}_upstream_member_${name}":