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 [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.