Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redhat version fix #615

Merged
merged 2 commits into from
Jun 15, 2017
Merged

redhat version fix #615

merged 2 commits into from
Jun 15, 2017

Conversation

andyroyle
Copy link
Contributor

The redhat version numbers now have the os version appended, which when combined with this version number validation means that 0.28.0-1.el7 is rejected by the module, but 0.28.0-1 won't select the package correctly from the yum repo.

The options are: either remove the version number validation in init.pp, or transform the centos version number to include the .el5, .el6 or .el7 suffix.

In the interests of making it easier to have one version that applies to all environments (debian, redhat, windows, etc) I've opted for the latter.

I'm not sure what side-effects this might have, so let me know if you think this is a terrible idea.

@rgeniesse
Copy link

rgeniesse commented Mar 1, 2017

Nice! I couldn't figure out why my runs were failing after updating the repo with yum seeing the new software fine.

The only piece I had to make a modification to was here:

default => "${sensu::version}.el${operatingsystemmajrelease}"

Not sure if my puppet version (1.7.1) is causing it, but I don't have a os_maj_version fact.

@andyroyle
Copy link
Contributor Author

@rgeniesse cheers for the heads up! $::operatingsystemmajrelease seems to work fine for me as well so I'll use that instead 👍

@rgeniesse
Copy link

Sweet! They must have depreciated the other fact. I can't seem to find a search hit saying so though.

The only other thing I have noticed is that most of my clients are on 0.26.5-2. My puppet runs going to 27.1-2 work, but if I try to leave nodes at 0.26.5-2, it can't find 0.26.5-2.el5:

Notice: /Stage[main]/Sensu::Repo::Yum/Yumrepo[sensu]/baseurl: baseurl changed 'http://repositories.sensuapp.org/yum/$basearch/' to 'http://repositories.sensuapp.org/yum/$releasever/$basearch/' Error: Could not update: Could not find package sensu-0.26.5-2.el5 Error: /Stage[main]/Sensu::Package/Package[sensu]/ensure: change from 1:0.26.5-2 to 0.26.5-2.el5 failed: Could not update: Could not find package sensu-0.26.5-2.el5

And an upgrade to 0.27.1-2 works:

Notice: /Stage[main]/Sensu::Repo::Yum/Yumrepo[sensu]/baseurl: baseurl changed 'http://repositories.sensuapp.org/yum/$basearch/' to 'http://repositories.sensuapp.org/yum/$releasever/$basearch/' Notice: /Stage[main]/Sensu::Package/Package[sensu]/ensure: ensure changed '1:0.26.5-2' to '0.27.1-2.el5'

The RPM is definitely in the repo:

http://repositories.sensuapp.org/yum/5/x86_64/

But I can't even find it on the command line:
yum install sensu-0.26.5-2.el5 Loaded plugins: fastestmirror, kmod, rhnplugin, security This system is receiving updates from RHN Classic or Red Hat Satellite. Loading mirror speeds from cached hostfile Setting up Install Process No package sensu-0.26.5-2.el5 available. Nothing to do

sensu-0.27.0-1.el5 seems to be the earliest that can. Appears to be a repo issue, but I don't know enough about them to know what is wrong.

@andyroyle
Copy link
Contributor Author

blurgh. I feared this might happen. I'll take a look and see if I can work out whats wrong

@cwjohnston
Copy link
Contributor

@andyroyle @rgeniesse sorry for the confusion here, allow me to explain.

Sensu 0.27 is the first Sensu release built by us using Chef's Omnibus tools. One effect of this change is that version strings in the RPM metadata now include a .elX suffix, where X is the major version of Redhat. Switching to Omnibus builds also necessitated this change of repository structures, and in our restructured repository we have renamed old package files for consistency, but have not modified the old package version strings to add the new suffix.

This means

  • From 0.27 onward, both file names and version strings in RPM metadata will include the .elX suffix
  • Versions prior to 0.27 include the .elX suffix in their file name but do not include the suffix in RPM metadata

In the Sensu Chef cookbook I've implemented a helper method for generating appropriate version strings, perhaps a similar implementation might be useful here.

@rgeniesse
Copy link

rgeniesse commented Mar 2, 2017

Thanks @cwjohnston, that clears up the behavior I am seeing. I just upgraded all my Sensu agents today, mix of CentOS 5/6/7, using the code @andyroyle provided. Those all worked.

My only issue now is we have a few Amazon Linux nodes out there, but I haven't had time to dig into how to resolve those. Maybe a fact override somewhere. Or maybe they'll just have to sit on 0.26.5 for now.

Open to any final solution and happy to test people's ideas.

@jaxxstorm
Copy link
Contributor

This looks great to me. Can you fix the conflicts?

@andyroyle
Copy link
Contributor Author

rebased 👍

@jaxxstorm jaxxstorm merged commit 02c1dfc into sensu:master Jun 15, 2017
@cwjohnston
Copy link
Contributor

@andyroyle @jaxxstorm I think merging this has broken tests introduced in #645:

  1) sensu package setting version with redhat platform version suffix should contain Package[sensu] with ensure => "0.29.0-1.el7"
     Failure/Error:
       it { should contain_package('sensu').with(
         :ensure => '0.29.0-1.el7'
       ) }
     
       expected that the catalogue would contain Package[sensu] with ensure set to "0.29.0-1.el7" but it is set to "0.29.0-1.el7.el7"
     # ./spec/classes/sensu_package_spec.rb:53:in `block (5 levels) in <top (required)>'

Automatically appending the OS major version without the ability to override it makes it impossible for folks like @rgeniesse to install the el7 package on many RedHat derivatives, e.g. Amazon Linux where the osmajorversion would be 2007.

Changes in #645 were intended to allow the version parameter value to include the elX suffix so that users of RedHat derivatives can specify the elX suffix that aligns with their platform's major version . Maybe there's some middle ground possible between these two approaches?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants