Puppet returns an error if a package is already installed

2,409 views
Skip to first unread message

Mike

unread,
Mar 8, 2012, 5:05:05 PM3/8/12
to puppet...@googlegroups.com
I'm very new to Puppet, and new to this group, so I apologize if this has already been covered. I did a quick search but didn't quickly find an answer.

I have a manifest that among other things installs a couple of packages. These are not part of a repository, so I use puppet to send the rpm file to the agent, then do the installation. This works just fine if the package is not already installed. However, if the package is already installed, it returns an error. This has to be a bug, right?

  package { 'jdk-6u16-linux-amd64.rpm':
        ensure   =>  installed,
        source   =>  "/usr/java/jdk-6u16-linux-amd64.rpm",
        require  =>  File['jdk-6u16-linux-amd64.rpm'],
  }

the error:

err: /Stage[main]/Ulbridge/Package[jdk-6u16-linux-amd64.rpm]/ensure: change from absent to present failed: Execution of '/bin/rpm -i --oldpackage /usr/java/jdk-6u16-linux-amd64.rpm' returned 1:       package jdk-1.6.0_16-fcs.x86_64 is already installed

If I then have another file/package/whatever that depends on that package (require => Package['jdk-6u16-linux-amd64.rpm']) it will fail because the package errored out. This isn't by design, is it? How do I get around it?

Nan Liu

unread,
Mar 8, 2012, 6:09:50 PM3/8/12
to puppet...@googlegroups.com
On Thu, Mar 8, 2012 at 2:05 PM, Mike <mrwbo...@gmail.com> wrote:
> I'm very new to Puppet, and new to this group, so I apologize if this has
> already been covered. I did a quick search but didn't quickly find an
> answer.
>
> I have a manifest that among other things installs a couple of packages.
> These are not part of a repository, so I use puppet to send the rpm file to
> the agent, then do the installation. This works just fine if the package is
> not already installed. However, if the package is already installed, it
> returns an error. This has to be a bug, right?
>
>   package { 'jdk-6u16-linux-amd64.rpm':
>         ensure   =>  installed,
>         source   =>  "/usr/java/jdk-6u16-linux-amd64.rpm",
>         require  =>  File['jdk-6u16-linux-amd64.rpm'],
>   }

From the output below the name of the package should just simply be
jdk instead of jdk-6u16..., use the command 'puppet resource package'
and look at the output for a better idea.

> the error:
>
> err: /Stage[main]/Ulbridge/Package[jdk-6u16-linux-amd64.rpm]/ensure: change
> from absent to present failed: Execution of '/bin/rpm -i --oldpackage
> /usr/java/jdk-6u16-linux-amd64.rpm' returned 1:       package
> jdk-1.6.0_16-fcs.x86_64 is already installed
>
> If I then have another file/package/whatever that depends on that package
> (require => Package['jdk-6u16-linux-amd64.rpm']) it will fail because the
> package errored out. This isn't by design, is it? How do I get around it?

HTH,

Nan

Mike

unread,
Mar 9, 2012, 9:54:37 AM3/9/12
to puppet...@googlegroups.com
Thank you so much. That solved my problem.
Reply all
Reply to author
Forward
0 new messages