Skip to content

Commit

Permalink
use ruby 1.9 hash syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
maage committed Sep 1, 2016
1 parent 2ddfcff commit d4ea1c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/facter/selinux_custom_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'facter'

Facter.add(:selinux_custom_policy) do
confine :kernel => 'Linux', :osfamily => 'RedHat', :operatingsystemmajrelease => '7', :selinux => ['true', true]
confine kernel: 'Linux', osfamily: 'RedHat', operatingsystemmajrelease: '7', selinux: ['true', true]
setcode do
Facter::Util::Resolution.exec("sestatus | grep 'Loaded policy name' | awk '{ print \$4 }'")
end
Expand Down

19 comments on commit d4ea1c6

@PascalBourdier
Copy link

@PascalBourdier PascalBourdier commented on d4ea1c6 Nov 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have some troubles on RHEL5 (puppet 3.8.7 on client side)

Error loading fact /var/lib/puppet/lib/facter/selinux_custom_policy.rb: /var/lib/puppet/lib/facter/selinux_custom_policy.rb:8: syntax error, unexpected ':', expecting kEND
  confine kernel: 'Linux', osfamily: 'RedHat', ...
                 ^
/var/lib/puppet/lib/facter/selinux_custom_policy.rb:8: syntax error, unexpected ',', expecting kEND
  confine kernel: 'Linux', osfamily: 'RedHat', operating...
                          ^
/var/lib/puppet/lib/facter/selinux_custom_policy.rb:8: syntax error, unexpected ',', expecting kEND
...: 'Linux', osfamily: 'RedHat', operatingsystemmajrelease: '7...
                              ^
/var/lib/puppet/lib/facter/selinux_custom_policy.rb:8: syntax error, unexpected ',', expecting kEND
...peratingsystemmajrelease: '7', selinux: ['true', true]
                              ^
/var/lib/puppet/lib/facter/selinux_custom_policy.rb:14: undefined (?...) sequence: /^Loaded policy name:\s*(?<policy>.*)$/

Do you have a workaround for this ?
Could you roll back ? Another "confine" usages like stdlib module for example keep the old syntax for hash (maybe for compat reasons ...)

@jyaworski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PascalBourdier Ruby 1.8.7 is not supported.

@PascalBourdier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to distrowatch, the RHEL5 end of life is 2017-03

source : https://distrowatch.com/table.php?distribution=redhat

Have you some troubles with the old style syntax ?

@jyaworski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several mechanisms that allow one to update the version of ruby that puppet uses, RVM being one of them. The EoL for Ruby 1.8.7 was more than two years ago.

https://www.ruby-lang.org/en/news/2014/07/01/eol-for-1-8-7-and-1-9-2/

@PascalBourdier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCL (or equivalent) doesn't exist for EL5 !

RVM is very hard to maintain in production (patch management)

So we can see RHEL compat for version 5 in forge : https://forge.puppet.com/puppet/selinux/compatibility

@jyaworski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RHEL5 is supported, but it's unfortunate that puppet does not offer a "rubies supported" as well. I would ask that you take a look at https://forge.puppet.com/maestrodev/rvm for managing rvm/ruby. Local mirrors with rvm can go a long way to keeping an updated ruby on an older OS. Various members of the VoxPupuli team go this route.

@kTitan
Copy link

@kTitan kTitan commented on d4ea1c6 Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to comment on such an old PR, but because the discussion was already here I do not want to open a new issue.

We have just hit also that problem on RHEL 6
In an production (enterprise) environment it is not so easy to rollout an new ruby version.
All of our customers tries to use the packages which are directly supported by the vendor. In this case by Red Hat.
And even if you use the Red Hat Satellite Environment in which puppet is used, the ruby version is not changed.
It stays at 1.8.7 for RHEL6.

I think there must be work done on that issue, because this module clearly states, that it RHEL 5/6/6 compatible.

@jyaworski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kTitan correct. We do support those OS. However, that does not mean we support those OS with the system-provided packages. Using RVM and pointing puppet at that is a common solution.

@alexjfisher
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kTitan Migrating to puppet 4 is another solution. The All-In-One packages provided by Puppet Inc come complete with their own ruby 2.1 (IIRC). Also worth remembering, Puppet 3 is End-of-Life in 2 weeks time.

@kTitan
Copy link

@kTitan kTitan commented on d4ea1c6 Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyaworski perhaps this should be then pointed out somewhere in the readme. Or did I only missed that?

And yes I see your point and also could accept it, if it is used in an open EL variant like CentOS.
But I can hardly believe that anyone who is using RHEL itself is using that approach...

@kTitan
Copy link

@kTitan kTitan commented on d4ea1c6 Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexjfisher migrating to puppet 4 is also not the possible solution. Because Red Hat does not ship and support that version yet.
As I said before that are only solutions for the free EL Linux variants. And don't understand me wrong. The solutions are good! But simply not for the enterprise environment where the customers are using the package from Red Hat. Of course it would look other if the customers would also have a subscription to PE. But that is an other point :)

@alexjfisher
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrating to puppet 4 is also not the possible solution. Because Red Hat does not ship and support that version yet.

RedHat doesn't ship or support any version of puppet in EL6 according to https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Package_Manifest/index.html

@vinzent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyaworski I'm with @kTitan that Puppet 3.8.x on RHEL6 is Puppet 3.8 + Ruby 1.8.7 by default. If it's just the new syntax for hashes it might not be worth to force people to run a newer Ruby (IMHO).

Or just drop Puppet 3.x support completly as it will cease by end of the year. And Puppet 4 with the puppet-agent AIO delivers its own Ruby.

@vinzent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kTitan if you wan't support from RedHat you would need to go to Ansible. RedHat does not support Puppet and never had. They only support the Puppet Master with Satellite 6 (which nobdoy who I know wants to use) - but no clients/agents. IMHO they are still on Puppet 3.6 something.

@jyaworski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinzent believe me, I believe I speak for all of VP that we want to drop 3.x ASAP. RedHat refusing to update Ruby or even provide an updated package natively is quite odd. Nobody likes using Software Collections or knows about it, which is their stated solution.

@kTitan
Copy link

@kTitan kTitan commented on d4ea1c6 Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinzent Yes they support the Puppet Master with Satellite 6. With the current version (6.2) it is now good enough, that I know many who give an new try. (Puppet Version is 3.8.6)
For the client you need the smart management add-on subscription. AFAIK with this subscription comes also the support for the clients. They distribute it in the satellite tools channel.
But in that point I can be wrong. I am not so deep into that topic.

@jyaworski nice to that you will drop that support soon. But please state it clearly in the readme, perhaps even with a comment, which module version was the latest with the 3.x support.
That will make sure that you do not get to much questions for that :)

@alexjfisher
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kTitan You're right. Dropping ruby 1.8 support should have appeared in the changelog and for some reason got missed for this module. Naughty @bastelfreak! :)

@vinzent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyaworski

RedHat refusing to update Ruby or even provide an updated package natively is quite odd.

redhat is not refusing, this is by design. they support Ruby 1.8.7 througout the RHEL6 lifecycle. so they will backport (security-) fixes to this old version upto about the year 2020.

@jyaworski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinzent right. My point is that they aren't providing an updated version, not that they're keeping 1.8.7. You could always scl enable ruby-1.9.3 or whatever it's called, but people don't like doing that. It causes a lot of frustration for us as module developers.

Please sign in to comment.