Ask Your Question
0

writing module for fisheye/crucible

asked 2015-05-18 13:34:56 -0500

pup-master gravatar image

updated 2015-05-18 22:52:39 -0500

I'm in the process of writing a init.pp file to automate installation of Atlassian fisheye/crucible.

But I'm keep running into

"Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Could not match ${srcdir}/fisheye-3.8.0.zip", at /etc/puppet/environments/production/manifests/init.pp:17 on node jira.oracle"

error.

[site.pp]

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

[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}"

    wget::fetch { 'java':
    source      => "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm",
    destination => "${srcdir}/jdk-8u45-linux-x64.rpm",
  } ->

   exec { 'java':
    command => "sudo 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 => "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 => "sudo /etc/ficr/./start.sh",
    path => "${srcdir}/",
    logoutput => "on_failure",
  } 
}

(UPDATE: validation came back clear, but agent spits out. new errors)

Notice: /Stage[main]/Fishcruc/Wget::Fetch[java]/Exec[wget-java]/returns: /home/oracle/Downloads/jdk-8u45-linux-x64.rpm: No such file or directory
Error: wget --no-verbose --output-document='/home/oracle/Downloads/jdk-8u45-linux-x64.rpm' 'http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm' returned 1 instead of one of [0]
Error: /Stage[main]/Fishcruc/Wget::Fetch[java]/Exec[wget-java]/returns: change from notrun to 0 failed: wget --no-verbose --output-document='/home/oracle/Downloads/jdk-8u45-linux-x64.rpm' 'http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm' returned 1 instead of one of [0]
Notice: /Stage[main]/Fishcruc/Exec[java]: Dependency Exec[wget-java] has failures: true
Warning: /Stage[main]/Fishcruc/Exec[java]: Skipping because of failed dependencies
Notice: /Stage[main]/Fishcruc/File[/etc/environment]: Dependency Exec[wget-java] has failures: true
Warning: /Stage[main]/Fishcruc/File[/etc/environment]: Skipping because of failed dependencies
Notice: /Stage[main]/Fishcruc/Wget::Fetch[ficr]/Exec[wget-ficr]: Dependency Exec[wget-java] has failures: true
Warning: /Stage[main]/Fishcruc/Wget::Fetch[ficr]/Exec[wget-ficr]: Skipping because of failed dependencies
Notice: /Stage[main]/Fishcruc/Exec[ficr]: Dependency Exec[wget-java] has failures: true
Warning: /Stage[main]/Fishcruc/Exec[ficr]: Skipping because of failed dependencies
Notice: /Stage[main]/Fishcruc/Exec[start]: Dependency Exec[wget-java] has failures: true
Warning: /Stage[main]/Fishcruc/Exec[start]: Skipping because of failed dependencies
Notice: Finished catalog run in 0.77 seconds
edit retag flag offensive close merge delete

Comments

Read that error message closely, and what is it indicating to you, especially the message "Please qualify the command or specify a path". Make sure to check the documentation for the exec resource type, and you will find the answer.

GregLarkin gravatar imageGregLarkin ( 2015-05-18 17:47:34 -0500 )edit

Thank you again and again. Learned something about exec resource and updated the post. I get new errors now. No clue!

pup-master gravatar imagepup-master ( 2015-05-18 22:51:17 -0500 )edit

The output of the agent indicates that the JDK RPM was not downloaded successfully. If you plug your download URL into a browser, you cannot download that file without user interaction to accept license terms. You'll need to stage the file elsewhere after downloading manually, I think.

GregLarkin gravatar imageGregLarkin ( 2015-05-19 17:48:02 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-05-18 16:59:05 -0500

GregLarkin gravatar image

You appear to have a dangling -> on the second-to-last line. I would expect that to cause some error, although I don't know if it's the one that's reported. What is the output of puppet parser validate init.pp?

Also, it's a good idea to separate your node definitions from your class definitions. Node definitions should be placed in site.pp (or other files in the top-level manifests/ directory), and your class definitions should be placed in the standard module directory layout: https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html. You'll just run into fewer problems with the compiler if you do that.

You'll also need to install https://forge.puppetlabs.com/maestrodev/wget and add include wget to your init.pp for the wget::fetch defined type to work.

edit flag offensive delete link more

Comments

Thank you for your time. I edited my post, could you see if it's better & reflects the changes you recommended?

pup-master gravatar imagepup-master ( 2015-05-18 17:18:22 -0500 )edit

Please post the output of "puppet parser validate init.pp". It looks like you may have some parser errors that need to be corrected before you can debug further.

GregLarkin gravatar imageGregLarkin ( 2015-05-18 17:21:35 -0500 )edit

Just edited, please check. Thank you for your time again.

pup-master gravatar imagepup-master ( 2015-05-18 17:22:39 -0500 )edit

It looks like the statement "include wget," is embedded within the class parameter list, so move it down where the $srcdir variable is defined. Also, remove the trailing comma from it. Next, remove the dangling "->" near the end of the file. Then run puppet parser validate to check syntax again.

GregLarkin gravatar imageGregLarkin ( 2015-05-18 17:28:43 -0500 )edit

Updated, please look.. Thanks again!

pup-master gravatar imagepup-master ( 2015-05-18 17:45:26 -0500 )edit
1

answered 2015-06-05 09:31:09 -0500

Cesar Sturion gravatar image

Hi,

I did it using this form:

# Download the file
exec { "down_java":
  path    => '/usr/bin',
  cwd     => '/tmp/',
  command => "wget --no-cookies --no-check-certificate --header \"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie\" \"${url}\"",
  timeout => 1200,            
}
edit flag offensive delete link more

Comments

I've made some progress. Would you mind checking http://ask.puppetlabs.com/question/17680/unzip-to-launch/ Thanks!!

pup-master gravatar imagepup-master ( 2015-06-05 09:53:50 -0500 )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-18 13:34:56 -0500

Seen: 236 times

Last updated: Jun 05 '15