Ask Your Question
0

exec commands for this history (atlassian - fisheye/crucible)

asked 2015-05-27 12:36:35 -0600

pup-master gravatar image

updated 2015-06-01 15:16:38 -0600

Since there aren't modules for atlassian's fisheye/crucible.

I'm using a bunch of exec commands to achieve my goal.

I first ran a manual install to pick up the commands I need to automate:

  107  sudo rpm -Uvh jdk-8u45-linux-x64.rpm 
  108  sudo vim /etc/environment 
  109  cd fecru
  110  cd fecru-3.8.0/
  111  cd ..
  112  sudo chmod a+rwx fecru-3.8.0/
  113  cd fecru
  114  cd fecru-3.8.0/
  115  ls
  116  ls -la
  117  sudo chmod -R a+rwx fecru-3.8.0/
  118  sudo chmod -R a+rwx /fecru-3.8.0/
  119  cd ..
  120  sudo chmod -R a+rwx /fecru-3.8.0/
  121  sudo chmod -R a+rwx fecru-3.8.0/
  122  sudo gedit /etc/environment 
  123  pwd
  124  sudo ./start.sh 
  125  start.sh
  126  sudo chmod a+rwx start.sh 
  127  sudo ./start.sh 
  128  sudo vim /etc/sysconfig/iptables

These are my current pp files:

[init.pp]

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 { "/home/oracle/Downloads/jdk-8u45-linux-x64.rpm":
            owner => "root", 
            source => "puppet:///fs/jdk-8u45-linux-x64.rpm",
         }


   exec { 'java': 
    command => “bash -c ‘rpm -Uvh jdk-8u45-linux-x64.rpm’”,
    path => "${srcdir}/",
    logoutput => "on_failure",
  } ->

   file { '/etc/environment':
    ensure  => present,
    content => "export JAVA_HOME=/usr/java/jdk1.8.0_45",
     } ~>

    wget::fetch { 'ficr':
    source      => "https://www.atlassian.com/software/fisheye/downloads/binary/fisheye-3.8.0.zip",
    destination => "${srcdir}/fisheye-3.8.0.zip",
    } ->


  exec { 'ficr':
    command => “bash -c ‘tar zxvf ${srcdir}/fisheye-3.8.0.zip && chown -R ${user} fisheye-3.8.0’”,,
    creates => "${installdir}/fisheye-3.8.0",
    cwd     => $installdir,
    logoutput => "on_failure",
    path => "${dir}/",
  } ->

  exec { 'start':
    command => "/etc/ficr/./start.sh",
    path => "${srcdir}/",
    logoutput => "on_failure",
  } 
}

[site.pp]

node 'jira.oracle' { class {'fishcruc':} }

These are the errors:

Error: Could not find command 'rpm'
Error: /Stage[main]/Fishcruc/Exec[java]/returns: change from notrun to 0 failed: Could not find command 'rpm'

Why can't puppet find commands? I looked up the web and I need to invoke "bash -c," etc but still not sure.

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-05-27 21:43:41 -0600

I think you have confused the exec type's path and cwd attributes.

Path is the search path used for command execution; cwd is the directory from which to run the command; so you should have something like:

exec { 'java': 
  command => 'rpm -Uvh jdk-8u45-linux-x64.rpm',
  path => '/bin',
  cwd => ${srcdir},
  logoutput => 'on_failure',
}

I don't see any reason to wrap your command in bash -c either.

edit flag offensive delete link more

Comments

Thanks for your time. How would you define where logs are stored for "logoutput" ?

pup-master gravatar imagepup-master ( 2015-06-01 11:48:38 -0600 )edit

There aren't any separate log files; logoutput causes the command output to appear in the puppet run log, which normally goes to the system log. I don't think this is configurable.

Alex Harvey gravatar imageAlex Harvey ( 2015-06-01 19:28:45 -0600 )edit

ah go it. thanks! btw, doesn't matter whether they are in single(') or double(") quote?

pup-master gravatar imagepup-master ( 2015-06-01 22:39:06 -0600 )edit

If you're only quoting text, doesn't matter. If you're quoting text and interpolating a variable, like you're doing in the command attribute of the 'ficr' exec, then you need a double quote.

Alex Harvey gravatar imageAlex Harvey ( 2015-06-02 03:09:33 -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

Stats

Asked: 2015-05-27 12:36:35 -0600

Seen: 346 times

Last updated: Jun 01 '15