Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit b3e506a09695e93046ca1e12571f7f85b5f45c47 1 parent 613d5b0
@haf haf authored
View
4 lib/puppet/parser/functions/write_erl_args.rb
@@ -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|
View
6 lib/puppet/parser/functions/write_erl_config.rb
@@ -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
2  manifests/appconfig.pp
@@ -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
9 manifests/init.pp
@@ -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
5 manifests/params.pp
@@ -24,6 +24,11 @@
default => 'deb'
}
+ $package_provider = $::operatingsystem ? {
+ /(centos|redhat)/ => 'yum',
+ default => 'dpkg'
+ }
+
$architecture = $::operatingsystem ? {
/(centos|redhat)/ => 'el6.x86_64',
default => 'amd64'
View
29 manifests/vmargs.pp
@@ -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,25 +12,25 @@
# 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',
@@ -33,7 +38,7 @@
}
$manage_template = $template ? {
- '' => write_erl_args(vmargs_cfg),
+ '' => write_erl_args($vmargs_cfg),
default => template($template)
}
View
2  tests/config/vagrant-hiera.yaml
@@ -5,7 +5,7 @@
:hierarchy:
- %{environment}
- - common
+ #- common
:yaml:
:datadir: /tmp/vagrant-hiera/data
Please sign in to comment.
Something went wrong with that request. Please try again.