Hi all,

I am currently creating a java class to automate its installation. You
can find the class definition is below.

In a nutshell, it is creating a temp folder to put the ".bin" file,
copy the .bin file in the folder then runs the installation.

Since running the bin will create a couple of ".rpm" files, I wanted
them to be in the temp folder and not in "/".

The line that caused me problems is:
command => "sh -c 'cd ${$path_java_tmp_folder} && pwd && yes | ./$
{bin_java_install_package} '",

Originally, I tried
command => "sh -c 'cd ${$path_java_tmp_folder} && yes | ./$
{bin_java_install_package} '",

And at runtime, I received the following error message "err: /
Stage[main]/Java/Exec[install-java]/returns: change from notrun to 0
failed: sh: ./jdk-6u31-linux-x64-rpm.bin: No such file or directory"

Then I added: "&& pwd " and now it works... Whereas the "&& pwd" does
not actually do anything ...

Does anyone know about this? Would it be a bug?


Thanks in advance for your help.

Gael



class java {

        $path_java_tmp_folder = '/opt/java/'
        $bin_java_install_package = 'jdk-6u31-linux-x64-rpm.bin'
        $path_java_tmp_install_package = "${path_java_tmp_folder}$
{bin_java_install_package}"


        # 1 - create the folder
        # 2 - copy the jdk file in the folder
        # 3 - install the jdk rpm

        File['java-tmp-folder']->File['copy-java-install']-
>Exec['install-java']

        file {
        # Create the folder to store the bin file
        'java-tmp-folder':

                ensure  => directory,
                path    => $path_java_tmp_folder,
                owner   => 'root',
                group   => 'root',
                recurse => true ;

        # copy the jdk across

        'copy-java-install':

                ensure => file ,
                path   => $path_java_tmp_install_package,
                source => "puppet:///modules/java/$
{bin_java_install_package}",
                owner  => 'root' ,
                group  => 'root' ,
                mode   => '0744' ,

        }


        exec { "install-java":

                path    => ["/usr/bin","/bin"],
                command => "sh -c 'cd ${$path_java_tmp_folder} && pwd
&& yes | ./${bin_java_install_package} '",
                unless  => "test -e /usr/bin/java";


        }

}

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

Reply via email to