Ask Your Question

unzip to ./launch

asked 2015-06-03 15:47:03 -0600

pup-master gravatar image

updated 2015-06-08 12:45:20 -0600

[UPDATE: I pasted my new pp code. The whole thing works! Can someone look at my java "unless" statement? and any other suggestions for improvements?]

Continuation to write a pp for atlassian fisheye/crucible journey. At the final stage. (Thanks to all who helped me get this far).

I got the exec part past the java rpm and now on unzip to launch script. fisheye/crucible seems relatively simple as it is just java >> unzip >> ./start.

How do I go from unzip to launch smoothly? After the pp runs, the zip isn't extracted. The folder is there though.


[oracle@agent bin]$ sudo puppet agent --verbose --no-daemonize --onetime
sudo: /etc/sudoers.d/proxy is world writable
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loching catalog for
Info: Applying configuration version '1433439265'
Notice: /Stage[main]/Fishcruc/Exec[start]/returns: executed successfully
Notice: Finished catalog run in 238.19 seconds


class fishcruc (

  $version = '3.8.0',
  $extension = 'zip',
  $installdir = '/etc/ficr',
  $home = '/var/local/ficr',
  $user = 'oracle') {

  $srcdir = '/home/oracle/Downloads'
  include wget
  $dir = "${installdir}/fisheye-${version}"

  file { 
        owner => "oracle", 
        source => "puppet:///fs/jdk-8u45-linux-x64.rpm",

  exec { 
        command => 'yum -y install /home/oracle/Downloads/jdk-8u45-linux-x64.rpm',
        path => '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin',
        cwd => $srcdir,
        logoutput => 'on_failure',
        unless => "yum -y install /home/oracle/Downloads/jdk-8u45-linux-x64.rpm ; echo $? -eq 0",
        } ->

  file { 
        ensure  => file,
        content => "export JAVA_HOME=/usr/java/jdk1.8.0_45",
        } ~>

  file { 
        ensure => "directory",
        owner  => "oracle",
        mode   => 777,

  file { 
         owner => "oracle", 
         source => "puppet:///fs/",

  exec { 
         command => '/usr/bin/unzip /home/oracle/',
         creates => "/etc/ficr/fecru-3.8.0/",
         cwd     => "/etc/ficr/",
         logoutput => "on_failure",
         path => '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin',
        } ->

  exec { 
    command => '/etc/ficr/fecru-3.8.0/bin/./',
        cwd => "/etc/ficr/fecru-3.8.0/bin/",
        path => '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin',
        logoutput => "on_failure",
edit retag flag offensive close merge delete


Did you try command => ''

Chutki gravatar imageChutki ( 2015-06-04 08:12:38 -0600 )edit

Yea but it seems the zip files hasn't unzipped to the specified folder.

pup-master gravatar imagepup-master ( 2015-06-04 08:41:03 -0600 )edit

For your `exec { 'java':` class, have you considered simply using the Package type which can install a local RPM with the `source =>` parameter?

stefanlasiewski gravatar imagestefanlasiewski ( 2015-06-04 14:00:51 -0600 )edit

I'm a bit dumber in that sense. could elaborate more with an example? Thanks for your time.

pup-master gravatar imagepup-master ( 2015-06-04 14:32:31 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-06-07 01:58:43 -0600

updated 2015-06-07 02:00:55 -0600

My comments would be:

1) your indenting is all over the place.

2) you have a notification arrow chaining your /etc/environment to your /etc/ficr/ directory, which doesn't make any sense to me.

3) you seem to have misunderstood the purpose of the path attribute to exec resources. All you need there is /bin as the purpose is simply to allow puppet to find the binary command or commands in your command attribute. If you need to set resource defaults for all execs you should have a block like

Exec {
  path => '/bin',

4) the unless you refer to should indeed be (I think) just rpm -q <rpm name="">.

5) As someone said above, you should look into using the package resource type to install RPMs rather than exec.

edit flag offensive delete link more


for 1) thanks, I'll adjust indenting, 2) you mean after {content => "export JAVA_HOME=/usr/java/jdk1.8.0_45"} I have "~>"?, 3) still confusing with cwd. 4/5) so like "package ensure" then installing with exec? , thanks a lot!

pup-master gravatar imagepup-master ( 2015-06-08 12:07:08 -0600 )edit

Fixed indentation. Trying to do this without private repository. My company already has one. But please still take a look at my previous comment. Thanks again!

pup-master gravatar imagepup-master ( 2015-06-08 14:01:47 -0600 )edit

2) yes you have ~> It's not doing anything useful and should be removed. 3) Not sure that I can explain this more than I already have - you may have to refer to the docs. 4) I'm saying unless => 'rpm -q jdk-8u45-linux-x64.rpm'.

Alex Harvey gravatar imageAlex Harvey ( 2015-06-08 19:32:10 -0600 )edit

Hopefully some of this will sink in over time and it will start to make more sense.

Alex Harvey gravatar imageAlex Harvey ( 2015-06-08 19:33:02 -0600 )edit

Will look into the docs. Thanks a lot for your kind answer and explanations

pup-master gravatar imagepup-master ( 2015-06-08 19:48:39 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-06-03 15:47:03 -0600

Seen: 501 times

Last updated: Jun 08 '15