feist/pcs — pull request #48 by deriamis (2014-09-12 22:00:22+00:00)
Title: Fix pcsd RHEL6/C6 compatibility

This commit would fix both pcs and pcsd compatibility with RHEL 6/CentOS 6 when the required software versions are actually installed (such as with a custom RPM):

1) All checks for "release 6" via /etc/redhat-release were converted to checks for required software versions instead.
2) The logic for "is_rhel6" was reversed to "is_rhel7_compat"
3) All references to systemd or systemctl were placed behind conditionals specific to systemd being installed. Some of these were previously if_rhel6 checks.
4) pcsd/ssl.rb has been modified so daemonizing pcsd will now work on both RHEL 6 and RHEL 7. On RHEL 6, the systemd callback is not used and WEBRick::Daemon::start is called instead so it forks properly.
5) The top-level Makefile has been altered to check for the presence of systemctl when installing init files so it won't install systemd stuff if it's not there, but it will install the init script in that case.
6) pcsd/Makefile was modified so it considers the Ruby gems a dependency of build_gems (which won't try downloading gems), and it doesn't try to differentiate between RHEL 6 and RHEL 7 gems anymore.
7) pcsd/Gemfile (and pcsd/Gemfile.lock) have been modified so that the one problematic gem in RHEL 6 (rpam-ruby19-feist) is now pulled from a git repository instead.
8) Some dependencies were not being included in pcsd/Gemfile (and pcsd/Gemfile.lock), and they have been added so the build from makefile works correctly.
8) pcsd/pscd.rb was modified so it requires bundler/setup and executes Bundler.setup(:default), which allows rpam-ruby19-feist to be used (since rubygems won't do it).
9) pcsd/pcsd (the init script) was modified to execute via bundler rather than directly with ruby, which allows the bundled gems to be required properly (needed for rpam-ruby19-feist).
10) A few text changes to errors so the compatibility check is more obvious (saying "this isn't RHEL 7" versus "you're using X software").

I know this is a large commit, but I really did not see any way of breaking it up into something more manageable in this case. I have tested this on a RHEL 6 box, but I don't have access to a RHEL 7 box at the moment to do further testing. I don't imagine any of the changes I made would be a problem for that, though. Please do let me know if you have any questions or suggestions!