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

fix FreeBSD support #455

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

fix FreeBSD support #455

wants to merge 2 commits into from

Conversation

fraenki
Copy link
Member

@fraenki fraenki commented Nov 3, 2022

Pull Request (PR) description

Avoid systemd-related code when running on non-Linux operating systems.

This Pull Request (PR) fixes the following issues

No issue found, just noticed that FreeBSD support is broken.

@@ -414,7 +414,7 @@
}
}

if $manage_service_file {
if $manage_service_file and $facts['kernel'] == 'Linux' {
Copy link
Member

Choose a reason for hiding this comment

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

manage_service_file seems to be false by default (from init.pp). I am wondering if it would make sense to use hiera to set it to true on systemd systems and false otherwise. That way you would not need to change its value to make the module useful (assuming you have a mix of Linux and FreeBSD systems and a single profile that setup redis on these systems).

If I am guessing wrong, maybe we can rely on stdlib's service_provider fact rather than the kernel one:

Suggested change
if $manage_service_file and $facts['kernel'] == 'Linux' {
if $manage_service_file and $facts['service_provider'] == 'systemd' {

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the idea of using the service_provider fact, now implemented in the most recent commit.

However, relying on manage_service_file would be great, but there is no module data directory right now. Instead I've changed the parameter to use the value from $redis::manage_service_file. I hope this will make it possible to set a global default on FreeBSD systems.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have to add that using $redis::manage_service_file would change the default value from true to false, which is probably a bad idea for other operating systems. So I should probably revert this and just rely on the service_provider fact in both cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -414,7 +414,7 @@
}
}

if $manage_service_file {
if $manage_service_file and and $facts['service_provider'] == 'systemd' {
Copy link
Member

Choose a reason for hiding this comment

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

and and causing the CI failure 😄

@bastelfreak
Copy link
Member

@fraenki thanks for the PR, can you please ass FreeBSD to the metadata.json?

@fraenki
Copy link
Member Author

fraenki commented Nov 9, 2022

Thank your both for your review :)
I was actually thinking more about this and will probably submit a new PR with more fleshed out FreeBSD support.

@ekohl ekohl marked this pull request as draft February 16, 2024 20:20
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.

3 participants