basho-labs / puppet-riak

A puppet module to deploy Riak clusters
Apache License 2.0
33 stars 37 forks source link

Feature/package version #15

Closed haf closed 10 years ago

haf commented 11 years ago

When I try this on another puppet module:

Error: Could not update: Execution of '/bin/rpm -U --oldpackage /tmp/riemann-0.2.0-1.noarch.rpm' returned 1:    package
riemann-0.2.0-1.noarch is already installed

Error: /Stage[main]/Riemann::Package/Package[riemann]/ensure: change from 0.2.0-1 to 0.2.0 failed: Could not update: Exe
cution of '/bin/rpm -U --oldpackage /tmp/riemann-0.2.0-1.noarch.rpm' returned 1:        package riemann-0.2.0-1.noarch i
s already installed

for code:

    $package_version = $version ? {
      ''      => 'installed',
      undef   => 'installed',
      default => $version,
    }
    package { 'riemann':
      ensure   => $package_version,
      source   => "/tmp/$package_name",
      provider => $package_provider,
      require  => Wget::Fetch['download_riemann'],
    }

Is this a problem with puppet or am I doing something wrong?

Iristyle commented 11 years ago

BTW -- I don't know how this happened, but one of our Vagrant boxes ended up with Riak 1.3.1 instead of 1.3.0, despite 1.3.0 being specified for the version... The installation goes exclusively through this Puppet module. If I can figure out what happened, I'll let you know.

haf commented 11 years ago

It's because the module only installs the package but doesn't give the version parameter to the package installer; hence it will install that latest.

If you don't want the latest it would be a good thing to freeze the version as you wanted to do (but that you wanted to do once to target the latest version), but when that is done, I get the pasted (above) error from yum; so I can't let the package resource get the $version parameter until I can understand why giving it produces the errors.

haf commented 11 years ago

The reason it gives errors is because of suffix on the semver that are needed for yum, such as "_1.el6", so that the version becomes "1.2.3_1.el6" or similar. That's next up to fix.

haf commented 10 years ago

Closing thx to @rdark.