Ask Your Question
0

running a manifest will returns change from notrun to 0 failed

asked 2015-07-07 07:51:54 -0600

Goran40 gravatar image

Hello, I have setup a short and simple manifest in site.pp - located in /etc/puppet/manifest with next exec :

$dependencies_dir = "/etc/puppet/modules/javacentos" $jre_installer = "jre-8u45-linux-x64.rpm" exec { 'jre-download': command => "wget --no-cookies --no-check-certificate --header 'Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie' ${jre_url} -O ${jre_installer}", } exec { "jre-8u45-linux-x64.rpm": path => ":/usr/bin:/bin:/usr/sbin:/sbin", command => "yum install ${dependencies_dir}/${jre_installer}", require => Exec["jre-download"], logoutput => 'true' }

When I run manifest this class exec "jre-8u45-linux-x64.rpm" is returning me

Error: yum install /etc/puppet/modules/javacentos/jre-8u45-linux-x64.rpm returned 1 instead of one of [0] Error: /Stage[main]/Main/Node[mynode.internal.cloudapp.net]/Exec[jre-8u45-linux-x64.rpm]/returns: change from notrun to 0 failed : yum install /etc/puppet/modules/javacentos/jre-8u45-linux-x64.rpm returned 1 instead of one of [0]

Can you please suggest me what might be the problem?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-07-07 15:06:34 -0600

cbarbour gravatar image

Your logs should show you the exact error, but off the top of my head, you probably need to pass the -y argument to RPM to allow the package to install without prompting for approval.

With that said, you shouldn't use an exec resource to install the package; the package resource is more suitable.

package { 'jre':   # <-- Make sure this matches the actual name of the package once installed.
  ensure => installed,
  source => "${dependencies_dir}/${jre_installer}",
  require =>  Exec["jre-download"],
}

You should also add some sort of condition to your exec resources to make sure they are idempotent. For the wget exec statement, a creates parameter will ensure that you only download the JRE installer once.

If possible, it's a good idea to use the staging module rather than execing wget.

Finally, if you don't indent your code by 4 spaces, it will print as one continuous line, which makes it hard to help. Ask uses markdown syntax; check out one of the guides if possible. :)

edit flag offensive delete link more
0

answered 2015-07-08 06:23:43 -0600

Goran40 gravatar image

thank you very much cbarbour. I am trying to use package but always get problems with dependencies .. I am trying to sort them but maybe you have an idea why this error is prompted when I use:

package {"jre-8u45-linux-x64": ensure => installed, source => "puppet//modules/javacentos", require => Exec ["jre-8u45-linux-x64"] }

Error: Failed to apply catalog: Could not find dependency Exec[jre-8u45-linux-x64] for Package[jre-8u45-linux-x64] at /etc/puppet/manifests/site.pp:39

edit flag offensive delete link more

Comments

Packages cannot use puppet:/// URIs as a source. Only URIs supported by the underlying package manager may be used. For EXEs, that means the local disk and CIFS paths. For MSI, that means HTTP, local disk, and CIFS.

cbarbour gravatar imagecbarbour ( 2015-07-08 14:59:22 -0600 )edit

The cause for the error is that Exec[jre-8u45-linux-x64] is not in your manifest. Make sure that it's defined somewhere. Also, make sure you quote your strings. It should be Exec['jre-8u45-linux-x64']

cbarbour gravatar imagecbarbour ( 2015-07-08 15:00:15 -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-07-07 07:51:54 -0600

Seen: 1,260 times

Last updated: Jul 08 '15