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

NIFI-1709 - Introduce logic to probe Linux version using /etc/os-rele… #1794

Closed
wants to merge 1 commit into from

Conversation

trixpan
Copy link
Contributor

@trixpan trixpan commented May 14, 2017

…ase to nifi.sh

        Add explicit paths to support SLES 11 SP4 / OpenSUSE init.d layout

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically master)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • ~~~Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?~~~
  • ~~~Have you written or updated unit tests to verify your changes?~~~
  • ~~~If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?~~~
  • ~~~If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?~~~
  • ~~~If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?~~~
  • ~~~If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?~~~

For documentation related changes:

  • ~~~Have you ensured that format looks appropriate for the output in which it is rendered?~~~

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.

…ase to nifi.sh

            Add explicit paths to support SLES 11 SP4 / OpenSUSE init.d layout
@trixpan
Copy link
Contributor Author

trixpan commented May 14, 2017

@apiri may I ask you to have a look on this?

Idea here is to use /etc/os-release to identify the Linux distribution and use that to flag some particular distro specific issues such as use of systemd vs upstart vs openrc vs whatever and adjust whenever needed.

@apiri
Copy link
Member

apiri commented May 22, 2017

@trixpan I think this seems okay overall. Not overly well versed in SUSE though. Could you explain why it needs special handling? Isn't it also systemd?

@jfrazee
Copy link
Member

jfrazee commented May 22, 2017

@trixpan @apiri Few things. It seems like we should be using lsb_release to grab the OS as well as chkconfig to handle creating run level symlinks instead of on on our own, at least for most of the OSes. And, while we install an init.d script and systemd can run those, we actually don't create a systemd unit today, so for many of the latest releases service and systemctl won't actually start nifi.

So I guess what I'm saying is that I think there might be 3 issues here: OS detection improvement, change how we set run levels, and add systemd unit and upstart scripts for OSes that aren't really doing sysv init anymore.

FWIW I've been using something like this for the systemd unit:

[Unit]
Description=Apache NiFi
After=network.target

[Service]
Type=forking
User={{ nifi_run_as }}
Group={{ nifi_run_as }}
ExecStart={{ nifi_install_dir }}/bin/nifi.sh start
ExecStop={{ nifi_install_dir }}/bin/nifi.sh stop
Restart=on-failure
RestartSec=60s

@trixpan
Copy link
Contributor Author

trixpan commented May 25, 2017

@apiri

SuSE may or may not be using systemd. Reason why we rely on systemd support to init scripts to achieve the outcome.

@jfrazee disagree regarding the use of lsb_release: it is an external dependency on most RPM based releases[1][2] and is known to cause issues on systems like Gentoo and archlinux. Same can be said about chkconfig.

[1] https://www.unixmen.com/linux-troubleshooting-fix-lsb_release-command-found-centos/
[2] http://0pointer.de/blog/projects/os-release.html

@jfrazee
Copy link
Member

jfrazee commented May 25, 2017

@trixpan Fair enough. Seems clear the lsb_release suggestion was bad. BTW, I tested your changes on opensuse:latest (leap) and it's working as expected.

@trixpan
Copy link
Contributor Author

trixpan commented May 25, 2017

@jfrazee thanks. I haven't tested on leap.

as not working you mean the file is not being linked or the service isn't being started?

Cheers

@trixpan
Copy link
Contributor Author

trixpan commented May 25, 2017

@jfrazee sorry. I misread your comment. It works on leap?! Great. :-)

@jfrazee
Copy link
Member

jfrazee commented May 25, 2017

@trixpan Yep, it's working. Is there any use in using the ID_LIKE variable instead of ID? If so we could change that up quick, else I think this is good to go.

@trixpan
Copy link
Contributor Author

trixpan commented May 25, 2017

@jfrazee I intentionally used ID as I noticed ID_LIKE seemed like a mix bag...

https://gist.github.com/djcp/6132025

@trixpan
Copy link
Contributor Author

trixpan commented Jun 1, 2017

@apiri @jfrazee - should I go ahead and merge this?

@jfrazee
Copy link
Member

jfrazee commented Jun 2, 2017

@trixpan LGTM +1 and I tested on SuSE and not SuSE.

You can go ahead and merge it or I can in my afternoon/your evening.

@asfgit asfgit closed this in 4d78052 Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants