Hello all,

I'm looking to run multiple commands via exec within a single class like so:

class boost_install {
        # This will place the gzip locally in /tmp.  File is pulled from 
puppet.
        file { "/tmp/boost_1_41_0.tar.bz2" :
                source  => "puppet:///boost_install/boost_1_41_0.tar.bz2" ,
                ensure  => present ,
        }

        # This will extract the boost gzip to the /tmp directory.
        # This will untar only if the /tmp/boost_1_41_0 directory does not 
exist.
        exec { "tar -xjvf /tmp/boost_1_41_0.tar.bz2" :
                cwd     => "/tmp/" ,
                creates => "/tmp/boost_1_41_0" ,
                path    => ["/bin" , "/usr/sbin"] ,
        }

        # This will run the boost bootstrapper. bjam should be run after 
this.
        # This will only run if the ls command returns a 1.
        # The unless will have to be redone because we have no way of 
upgrading easily and this is sloppy.
        exec    { "/tmp/boost_1_41_0/bootstrap.sh" :
                unless  => 'ls /usr/local/include/boost' ,
                path    => ["/bin/" , "/sbin/" , "/usr/bin/" , 
"/usr/sbin/"] ,
        }

        # This will run the boost bjam modifier and should run only after 
the bootstrap.sh has been run
        # This will only run if the ls command returns a 1.
        # This unless  will have to be redone because we have no way of 
upgrading easily and this is sloppy.
        exec { "/tmp/boost_1_41_0/bjam cxxflags=-fPIC install" :
                unless  => 'ls /usr/local/include/boost' ,
                path    => ["/bin/" , "/sbin/" , "/usr/bin/" , 
"/usr/sbin/"]  ,
        }
}

However, after running the above class, I get the following:

err: 
/Stage[main]/Boost_install/Exec[/tmp/boost_1_41_0/bootstrap.sh]/returns: 
change from notrun to 0 failed: /tmp/boost_1_41_0/bootstrap.sh returned 1 
instead of one of [0] at 
/etc/puppet/modules/boost_install/manifests/init.pp:18
err: /Stage[main]/Boost_install/Exec[/tmp/boost_1_41_0/bjam cxxflags=-fPIC 
install]/returns: change from notrun to 0 failed: /tmp/boost_1_41_0/bjam 
cxxflags=-fPIC install returned 1 instead of one of [0] at 
/etc/puppet/modules/boost_install/manifests/init.pp:21
notice: Finished catalog run in 1.31 seconds

I was under the impression that I should be getting the "install returned 
1" output but it's usually silent and the command doesn't run.  I'm 
assuming that neither the bootstrap or bjam commands should run as the 
/usr/local/include/boost directories exist on the machine and I'm expecting 
the "ls" to return a 0; which it does on the machine because those 
directories exist.

I'm obviously missing something here and I'm looking for some direction.

I do suspect that this can be done in a more elegant fashion especially 
since the bjam command is dependent upon the bootstrap.sh script running 
but I was hoping to at least get this working.

Thanks in advance for the thoughts.

Cheers,

Mike

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

Reply via email to