Permalink
Browse files

'require' vs 'inherits'

It seems like puppet's linter doesn't like inherits. Yet, I will get errors like

```
Warning: Scope(Class[Riak]): Could not look up qualified variable 'riak::params::erl_log_dir'; class riak::params has not been evaluated
```

...if I don't somehow get the params class loaded before the hiera function evaluates.

I tried putting  in my Class[riak] but that didn't help
at all. Imo, this should be an issue, because there must be a way to influence the static
class dependencies, like 'require' is meant to do, so that puppet applies the
requires ahead of evaluating the parameters' function invocations; to hiera(.., ..) in
this case.
  • Loading branch information...
haf committed Sep 1, 2012
1 parent 613d5b0 commit b3e506a09695e93046ca1e12571f7f85b5f45c47
@@ -1,4 +1,6 @@
-require 'puppet/parser/util/erly'
+# https://projects.puppetlabs.com/issues/4248
+# require 'puppet/parser/util/erly'
+require File.join(File.dirname(__FILE__), '/../util/erly')
module Puppet::Parser::Functions
newfunction(:write_erl_args, :type => :rvalue, :doc => <<-DOC) do |*args|
@@ -1,4 +1,6 @@
-require 'puppet/parser/util/erly'
+# https://projects.puppetlabs.com/issues/4248
+# require 'puppet/parser/util/erly'
+require File.join(File.dirname(__FILE__), '/../util/erly')
module Puppet::Parser::Functions
newfunction(:write_erl_config, :type => :rvalue, :doc => <<-DOC) do |*args|
@@ -26,4 +28,4 @@ module Puppet::Parser::Functions
::Puppet::Parser::Util::Config.new(h).send(s)
end
-end
+end
View
@@ -29,6 +29,8 @@
$absent = false
) {
+ require riak::params
+
# merge the given $cfg parameter with the default,
# favoring the givens, rather than the defaults
$appcfg = merge({
View
@@ -87,7 +87,7 @@
$disable = false,
$disableboot = false,
$absent = false
-) {
+) inherits riak::params {
include stdlib
@@ -167,9 +167,10 @@
}
package { 'riak':
- ensure => $manage_package,
- source => $pkgfile,
- require => [
+ ensure => $manage_package,
+ source => $pkgfile,
+ provider => $riak::params::package_provider,
+ require => [
Httpfile[$pkgfile],
Package[$riak::params::deps]
]
View
@@ -24,6 +24,11 @@
default => 'deb'
}
+ $package_provider = $::operatingsystem ? {
+ /(centos|redhat)/ => 'yum',
+ default => 'dpkg'
+ }
+
$architecture = $::operatingsystem ? {
/(centos|redhat)/ => 'el6.x86_64',
default => 'amd64'
View
@@ -1,3 +1,8 @@
+# == Misc
+# A full file is available for browsing at
+# https://raw.github.com/basho/riak/master/rel/files/vm.args
+#
+# == Parameters
# source:
# Sets the source parameter for the configuration file.
# Mutually exclusive with 'template'.
@@ -7,33 +12,33 @@
# with source.
#
class riak::vmargs(
- $vmargs_cfg = hiera('vmargs_cfg', {}),
+ $cfg = hiera('vmargs_cfg', {}),
$erl_log_dir = hiera('erl_log_dir', $riak::params::erl_log_dir),
$template = hiera('vm_args_template', ''),
$source = hiera('vm_args_source', ''),
$absent = false
-) {
+) inherits riak::params {
- $vmargs_cfg = merge(cfg, {
- nodename => 'riak',
- cookie => 'riak',
- ip => $::ipaddress,
- 'K' => true,
- 'A' => 64,
- smp => 'enable',
- env => {
+ $vmargs_cfg = merge({
+ '-name' => 'riak',
+ '-setcookie' => 'riak',
+ '-ip' => $::ipaddress,
+ '+K' => true,
+ '+A' => 64,
+ '-smp' => 'enable',
+ '-env' => {
'ERL_MAX_PORTS' => 4096,
'ERL_CRASH_DUMP' => "${$erl_log_dir}/erl_crash.dmp"
}
- })
+ }, $cfg)
$manage_file = $absent ? {
true => 'absent',
default => 'present'
}
$manage_template = $template ? {
- '' => write_erl_args(vmargs_cfg),
+ '' => write_erl_args($vmargs_cfg),
default => template($template)
}
@@ -5,7 +5,7 @@
:hierarchy:
- %{environment}
- - common
+ #- common
:yaml:
:datadir: /tmp/vagrant-hiera/data

0 comments on commit b3e506a

Please sign in to comment.