FAQ
I've just installed PE 2.7 and went through the quickstart. I was able to
install the motd module without an issue. I decided to try a Java install
module to test what I've (not) learned. I've looked at the init.pp file,
the name of the class is "java". It shows as installed correctly on the
agent using the puppet install command. I've added it in the console and
added it on the agent in the console. When I run puppet agent --test on the
agent side it comes back with: err: Could not retrieve catalog from remote
server: Error 400 on SERVER: Could not find class java for puppet-node1 on
node puppet-node1
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

What is different here?

--
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/-/bCB7ALRgTVUJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Jcbollinger at Dec 21, 2012 at 2:12 pm

    On Thursday, December 20, 2012 5:34:25 PM UTC-6, Kevin Kitchen wrote:
    [...] When I run puppet agent --test on the agent side it comes back
    with: err: Could not retrieve catalog from remote server: Error 400 on
    SERVER: Could not find class java for puppet-node1 on node puppet-node1
    warning: Not using cache on failed catalog
    err: Could not retrieve catalog; skipping run

    What is different here?

    Your "java" class is not located where the parser's autoloader expects to
    find it. Puppet will interpret a top-scope name such as "java" as a module
    name, and therefore look for the class definition in the module's init.pp.
    That would be <module-path>/java/manifests/init.pp in this case, which
    would contain

    class 'java' {
    # ...
    }

    Other classes in the same module would have names of the form java::foo,
    and the autoloader would look for them in (in this case)
    <module-path>/java/manifests/foo.pp.

    There's more, but the above will cover the vast majority of your needs.


    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/-/S8AYkr9oRJsJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Kevin Kitchen at Dec 21, 2012 at 5:09 pm
    Thank you for getting back to me on this. This is my init.pp file:
    class java {

    require java::params

    file {"$java::params::java_base":
    ensure => "directory",
    owner => "root",
    group => "root",
    alias => "java-base"
    }

    file {
    "${java::params::java_base}/jdk${java::params::java_version}.tar.gz":
    mode => 0644,
    owner => root,
    group => root,
    source =>
    "puppet:///modules/java/jdk${java::params::java_version}.tar.gz",
    alias => "java-source-tgz",
    before => Exec["untar-java"],
    require => File["java-base"]
    }

    exec { "untar jdk${java::params::java_version}.tar.gz":
    command => "tar -zxf
    jdk${java::params::java_version}.tar.gz",
    cwd => "${java::params::java_base}",
    creates =>
    "${java::params::java_base}/jdk${java::params::java_version}",
    alias => "untar-java",
    refreshonly => true,
    subscribe => File["java-source-tgz"],
    before => File["java-app-dir"]
    }

    file {
    "${java::params::java_base}/jdk${java::params::java_version}":
    ensure => "directory",
    mode => 0644,
    owner => root,
    group => root,
    alias => "java-app-dir"
    }
    }

    Based on what I understand you saying, class java is interpreted as the
    module name and the class would be called java_base. Unfortunately, this
    didn't work either. Do I have this wrong?
    On Thursday, December 20, 2012 3:34:25 PM UTC-8, Kevin Kitchen wrote:

    I've just installed PE 2.7 and went through the quickstart. I was able to
    install the motd module without an issue. I decided to try a Java install
    module to test what I've (not) learned. I've looked at the init.pp file,
    the name of the class is "java". It shows as installed correctly on the
    agent using the puppet install command. I've added it in the console and
    added it on the agent in the console. When I run puppet agent --test on the
    agent side it comes back with: err: Could not retrieve catalog from remote
    server: Error 400 on SERVER: Could not find class java for puppet-node1 on
    node puppet-node1
    warning: Not using cache on failed catalog
    err: Could not retrieve catalog; skipping run

    What is different here?
    --
    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/-/Kc1Vi6ow05YJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jcbollinger at Jan 2, 2013 at 3:12 pm

    On Friday, December 21, 2012 11:08:59 AM UTC-6, Kevin Kitchen wrote:
    Thank you for getting back to me on this. This is my init.pp file:
    class java {

    require java::params

    file {"$java::params::java_base":
    ensure => "directory",
    owner => "root",
    group => "root",
    alias => "java-base"
    }

    file {
    "${java::params::java_base}/jdk${java::params::java_version}.tar.gz":
    mode => 0644,
    owner => root,
    group => root,
    source =>
    "puppet:///modules/java/jdk${java::params::java_version}.tar.gz",
    alias => "java-source-tgz",
    before => Exec["untar-java"],
    require => File["java-base"]
    }

    exec { "untar jdk${java::params::java_version}.tar.gz":
    command => "tar -zxf
    jdk${java::params::java_version}.tar.gz",
    cwd => "${java::params::java_base}",
    creates =>
    "${java::params::java_base}/jdk${java::params::java_version}",
    alias => "untar-java",
    refreshonly => true,
    subscribe => File["java-source-tgz"],
    before => File["java-app-dir"]
    }

    file {
    "${java::params::java_base}/jdk${java::params::java_version}":
    ensure => "directory",
    mode => 0644,
    owner => root,
    group => root,
    alias => "java-app-dir"
    }
    }

    Based on what I understand you saying, class java is interpreted as the
    module name and the class would be called java_base. Unfortunately, this
    didn't work either. Do I have this wrong?

    Yes, you misunderstood me. Your original init.pp looks mostly fine on
    first reading. The name "java" is in this case both the module name and
    the name of a class in that module. Based on the error message, the
    problem is the *location* of that init.pp file. I explained the expected
    location in my previous post.

    You may encounter a problem with that class in that some of the resources
    refer to others that are declared later in the class body. I don't think
    Puppet is going to accept that, but the fix would be simply to re-order the
    resource declarations.

    Also, if class 'java::params' is a pure parameters class (declaring no
    resources, directly or indirectly), then it would be better form to use the
    'include' function rather than the 'require' function to include it. The
    'require' function is not harmful in that case, but it is a bit misleading
    because it has no more effect than a plain 'include'.


    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/-/ik8z_STVYc0J.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    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
postedDec 20, '12 at 11:52p
activeJan 2, '13 at 3:12p
posts4
users2
websitepuppetlabs.com

2 users in discussion

Jcbollinger: 2 posts Kevin Kitchen: 2 posts

People

Translate

site design / logo © 2022 Grokbase