FAQ
I was testing parameterized classes using an external node classifier
running on a 3.0.0rc2 master and found that catalog compilation fails
if I have a parameterized class that uses defaults if I declare an
instance of the class that does not specify values for all parameters.
I was able to reproduce the behavior using 'puppet apply':

logos: /tmp ] cat foo.pp
class foo($foo1="default1", $foo2="default2") {
file { "/tmp/foofile":
content => "foo1=\"$foo1\" foo2=\"$foo2\"\n"
}
}

class { "foo":
}

Rather than getting a file with the class default values, catalog
compilation fails:

logos: /tmp ] sudo puppet apply foo.pp
Error: Puppet::Parser::AST::Resource failed with error RuntimeError:
Hiera terminus not supported without hiera library at /tmp/foo.pp:8 on
node logos
Error: Puppet::Parser::AST::Resource failed with error RuntimeError:
Hiera terminus not supported without hiera library at /tmp/foo.pp:8 on
node logos

I get the same error if I declare a value for either one (but not
both) of the parameters but if I declare values for both parameters,
it works as expected:

class { "foo":
foo1 => "value1",
foo2 => "value2",
}

logos: /tmp ] sudo puppet apply foo.pp
/Stage[main]/Foo/File[/tmp/foofile]/ensure: defined content as
'{md5}42bcc1edf4e8ea1f2aeffafe2ef26712'
Finished catalog run in 0.41 seconds
logos: /tmp ] cat /tmp/foofile
foo1="value1" foo2="value2"

This class works fine with 'puppet apply' on all of the 2.7.x nodes
I've tested; I can declare the class with any valid combination of
default and non-default parameter values. It only fails on 3.0.0rc2.

Thanks,
Jason

--
"Life was better when sun4m mattered." -Thom

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Jcbollinger at Aug 16, 2012 at 1:53 pm

    On Wednesday, August 15, 2012 7:54:27 PM UTC-5, jwright wrote:
    I was testing parameterized classes using an external node classifier
    running on a 3.0.0rc2 master and found that catalog compilation fails
    if I have a parameterized class that uses defaults if I declare an
    instance of the class that does not specify values for all parameters.
    I was able to reproduce the behavior using 'puppet apply':

    logos: /tmp ] cat foo.pp
    class foo($foo1="default1", $foo2="default2") {
    file { "/tmp/foofile":
    content => "foo1=\"$foo1\" foo2=\"$foo2\"\n"
    }
    }

    class { "foo":
    }

    Rather than getting a file with the class default values, catalog
    compilation fails:

    logos: /tmp ] sudo puppet apply foo.pp
    Error: Puppet::Parser::AST::Resource failed with error RuntimeError:
    Hiera terminus not supported without hiera library at /tmp/foo.pp:8 on
    node logos
    Error: Puppet::Parser::AST::Resource failed with error RuntimeError:
    Hiera terminus not supported without hiera library at /tmp/foo.pp:8 on
    node logos

    I get the same error if I declare a value for either one (but not
    both) of the parameters but if I declare values for both parameters,
    it works as expected:

    class { "foo":
    foo1 => "value1",
    foo2 => "value2",
    }

    logos: /tmp ] sudo puppet apply foo.pp
    /Stage[main]/Foo/File[/tmp/foofile]/ensure: defined content as
    '{md5}42bcc1edf4e8ea1f2aeffafe2ef26712'
    Finished catalog run in 0.41 seconds
    logos: /tmp ] cat /tmp/foofile
    foo1="value1" foo2="value2"

    This class works fine with 'puppet apply' on all of the 2.7.x nodes
    I've tested; I can declare the class with any valid combination of
    default and non-default parameter values. It only fails on 3.0.0rc2.

    It sounds like you have a broken or incomplete puppet installation. Hiera
    is deeply integrated with Puppet 3, and in particular with resolving
    unspecified class parameters. It is not an optional third-party library as
    it was in Puppet 2.x and earlier. PuppetLabs provides it in a separate
    package, however, which might lead you to think that you don't need to
    install it.

    That does not mean you have to put anything in a hiera data store, or even
    configure one (as far as I know), but it needs to be there because in
    Puppet 3, the master tries to fill in parameter values via hiera before it
    falls back to default values specified in the class definition. (That
    behavior is awesome, btw.)


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/a7_k6Q2DORgJ.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jason Wright at Aug 16, 2012 at 6:38 pm

    On Thu, Aug 16, 2012 at 6:53 AM, jcbollinger wrote:
    It sounds like you have a broken or incomplete puppet installation.
    You are correct, installing hiera fixed it.

    Thanks,
    Jason

    --
    "Life was better when sun4m mattered." -Thom

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedAug 16, '12 at 12:54a
activeAug 16, '12 at 6:38p
posts3
users2
websitepuppetlabs.com

2 users in discussion

Jason Wright: 2 posts Jcbollinger: 1 post

People

Translate

site design / logo © 2023 Grokbase