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 Debian 8 support: configure for systemd #683

Closed
wants to merge 5 commits into from

Conversation

JayH5
Copy link
Contributor

@JayH5 JayH5 commented Mar 6, 2018

Debian 8 is listed as a supported platform in metadata.json, but the logic to detect systemd configuration seems to expect only Ubuntu within the Debian family. This checks for vanilla Debian vs Ubuntu and applies systemd configuration as necessary.

@JayH5
Copy link
Contributor Author

JayH5 commented Mar 6, 2018

I'm not sure what's going on with those Arch Linux test failures...that isn't a part of the code that I changed.

@@ -193,28 +193,22 @@
}

case $facts['os']['family'] {
'Archlinux': {
$has_systemd = true
Copy link
Member

Choose a reason for hiding this comment

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

Can we perhaps make use of the systemd fact in camptopcamp/systemd module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know much about that fact.. if it works accurately it would be cool to use. I can add the module as a dependency? It would also be useful for the systemctl daemon reload stuff.

Copy link
Member

Choose a reason for hiding this comment

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

yes, you can add it as a dependency to the metadata.json and use the fact

@wyardley
Copy link
Contributor

wyardley commented Mar 7, 2018

FWIW, I'm seeing those Arch test failures on current master as well. Paging Archlinux evangelist @bastelfreak to the white courtesy phone.
Could it be somehow related to voxpupuli/facterdb@fed15a7 (which added arch facts for Facter 2.5)?
jumping back to 0.5.0 "fixes" the problem, though I think that's just because arch doesn't get run in the 'on supported systems'.... loop then.

@bastelfreak
Copy link
Member

yes this is related to the new facts

@bastelfreak
Copy link
Member

@JayH5 I will have a look at the spec failures related to archlinux and fix them. I maybe already need to add the dependency to the systemd module. You can hold on with further development here until I fixed the current issues.

@bastelfreak
Copy link
Member

@JayH5 can you rebase please? I fixed spec errors in #685

@JayH5
Copy link
Contributor Author

JayH5 commented Mar 7, 2018

Did a quick rebase but there are errors now... I'm a little swamped with other things at the moment and might only get back to this next week.

@bastelfreak bastelfreak added needs-work not ready to merge just yet tests-fail labels Mar 14, 2018
@JayH5
Copy link
Contributor Author

JayH5 commented Mar 19, 2018

I've tried to make use of the systemd module. I hit a few bumps and it has taken me a while to get this working. I've run out of time to spend on this for now and the tests still aren't passing 😢.

I've done the bulk of the work here and would be grateful if somebody could take over. Otherwise, I will only be able to revisit again sometime in the future (1 week to 1 month's time).

@wyardley
Copy link
Contributor

wyardley commented May 8, 2018

bundle exec rake rubocop:auto_correct will fix the linter errors.
I have played a little with trying to use systemd module to manage limits in the past, and have not had the greatest of luck (though I thought this particular problem had already been resolved), because the types are a bit too restrictive. This is one reason why this module is still not using the camptocamp systemd module.

Currently, LimitNOFILE can still only be integer:
https:/camptocamp/puppet-systemd/blob/master/types/servicelimits.pp#L10

I'll see if I can submit a PR to fix this; until then, I don't think we can use this module to manage the systemd service limits. Even then, it would not be ideal, because folks would have to use the newest version.

      Puppet::PreformattedError:
        Evaluation Error: Error while evaluating a Resource Statement, Systemd::Service_limits[rabbitmq.service]: parameter 'limits' entry 'LimitNOFILE' expects an Integer[0] value, got Integer[-1, -1] (file: /Users/xx/git/puppet-rabbitmq/spec/fixtures/modules/rabbitmq/manifests/config.pp, line: 220) on node xxx

I personally suggest making a smaller incremental fix to keep this working on Debian 8 with the existing tooling, and then switch to systemd module if / when it becomes more practical.

@wyardley
Copy link
Contributor

wyardley commented May 8, 2018

voxpupuli/puppet-systemd#76
actually
voxpupuli/puppet-systemd#63 which is already open is probably more complete.

default: { }
}

if $::facts['systemd'] { # systemd fact provided by systemd module
Copy link
Member

Choose a reason for hiding this comment

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

We should not use topscope anymore. Please use $facts['systemd']

@@ -1425,6 +1413,13 @@
}
end

context 'on systems with systemd', if: facts[:systemd] do
Copy link
Member

Choose a reason for hiding this comment

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

nice, I always forget that we can set conditions within a context block

@@ -32,6 +32,10 @@
hasrestart => true,
name => $service_name,
}

if $::facts['systemd'] {
Copy link
Member

Choose a reason for hiding this comment

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

please use $facts['systemd']

@JayH5
Copy link
Contributor Author

JayH5 commented May 16, 2018

Rebased and updated as suggested. I'm still stumped by the Arch Linux test failures...if anybody has any ideas...

Once again, don't have a heck of a lot of time to work on this so may be slow to update and happy for others to take over.

@bastelfreak
Copy link
Member

@JayH5 the errors are not archlinux specific:

rspec ./spec/classes/rabbitmq_spec.rb[1:2:10:1] # rabbitmq on archlinux-4-x86_64 with file_limit => 'unlimited' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:10:2] # rabbitmq on archlinux-4-x86_64 with file_limit => 'unlimited' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:10:3] # rabbitmq on archlinux-4-x86_64 with file_limit => 'unlimited' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:11:1] # rabbitmq on archlinux-4-x86_64 with file_limit => 'infinity' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:11:2] # rabbitmq on archlinux-4-x86_64 with file_limit => 'infinity' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:11:3] # rabbitmq on archlinux-4-x86_64 with file_limit => 'infinity' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:12:1] # rabbitmq on archlinux-4-x86_64 with file_limit => '-1' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:12:2] # rabbitmq on archlinux-4-x86_64 with file_limit => '-1' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:12:3] # rabbitmq on archlinux-4-x86_64 with file_limit => '-1' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:13:3] # rabbitmq on archlinux-4-x86_64 with file_limit => '1234' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:2:19:1] # rabbitmq on archlinux-4-x86_64 on systems without systemd should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:10:1] # rabbitmq on centos-7-x86_64 with file_limit => 'unlimited' should contain File[/etc/security/limits.d/rabbitmq-server.conf] that notifies Class[Rabbitmq::Service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:10:2] # rabbitmq on centos-7-x86_64 with file_limit => 'unlimited' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:10:3] # rabbitmq on centos-7-x86_64 with file_limit => 'unlimited' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:11:1] # rabbitmq on centos-7-x86_64 with file_limit => 'infinity' should contain File[/etc/security/limits.d/rabbitmq-server.conf] that notifies Class[Rabbitmq::Service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:11:2] # rabbitmq on centos-7-x86_64 with file_limit => 'infinity' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:11:3] # rabbitmq on centos-7-x86_64 with file_limit => 'infinity' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:12:1] # rabbitmq on centos-7-x86_64 with file_limit => '-1' should contain File[/etc/security/limits.d/rabbitmq-server.conf] that notifies Class[Rabbitmq::Service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:12:2] # rabbitmq on centos-7-x86_64 with file_limit => '-1' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:12:3] # rabbitmq on centos-7-x86_64 with file_limit => '-1' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:13:3] # rabbitmq on centos-7-x86_64 with file_limit => '1234' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:6:19:1] # rabbitmq on centos-7-x86_64 on systems without systemd should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:10:1] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => 'unlimited' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:10:2] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => 'unlimited' should contain File[/etc/default/rabbitmq-server] with content =~ /ulimit -n unlimited/
rspec ./spec/classes/rabbitmq_spec.rb[1:7:10:3] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => 'unlimited' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:11:1] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => 'infinity' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:11:2] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => 'infinity' should contain File[/etc/default/rabbitmq-server] with content =~ /ulimit -n infinity/
rspec ./spec/classes/rabbitmq_spec.rb[1:7:11:3] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => 'infinity' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:12:1] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => '-1' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:12:2] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => '-1' should contain File[/etc/default/rabbitmq-server] with content =~ /ulimit -n -1/
rspec ./spec/classes/rabbitmq_spec.rb[1:7:12:3] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => '-1' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:13:3] # rabbitmq on ubuntu-16.04-x86_64 with file_limit => '1234' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:7:19:1] # rabbitmq on ubuntu-16.04-x86_64 on systems without systemd should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:10:1] # rabbitmq on redhat-7-x86_64 with file_limit => 'unlimited' should contain File[/etc/security/limits.d/rabbitmq-server.conf] that notifies Class[Rabbitmq::Service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:10:2] # rabbitmq on redhat-7-x86_64 with file_limit => 'unlimited' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:10:3] # rabbitmq on redhat-7-x86_64 with file_limit => 'unlimited' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:11:1] # rabbitmq on redhat-7-x86_64 with file_limit => 'infinity' should contain File[/etc/security/limits.d/rabbitmq-server.conf] that notifies Class[Rabbitmq::Service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:11:2] # rabbitmq on redhat-7-x86_64 with file_limit => 'infinity' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:11:3] # rabbitmq on redhat-7-x86_64 with file_limit => 'infinity' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:12:1] # rabbitmq on redhat-7-x86_64 with file_limit => '-1' should contain File[/etc/security/limits.d/rabbitmq-server.conf] that notifies Class[Rabbitmq::Service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:12:2] # rabbitmq on redhat-7-x86_64 with file_limit => '-1' should not contain File[/etc/default/rabbitmq-server]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:12:3] # rabbitmq on redhat-7-x86_64 with file_limit => '-1' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:13:3] # rabbitmq on redhat-7-x86_64 with file_limit => '1234' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:8:19:1] # rabbitmq on redhat-7-x86_64 on systems without systemd should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:10:1] # rabbitmq on debian-8-x86_64 with file_limit => 'unlimited' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:10:2] # rabbitmq on debian-8-x86_64 with file_limit => 'unlimited' should contain File[/etc/default/rabbitmq-server] with content =~ /ulimit -n unlimited/
rspec ./spec/classes/rabbitmq_spec.rb[1:9:10:3] # rabbitmq on debian-8-x86_64 with file_limit => 'unlimited' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:11:1] # rabbitmq on debian-8-x86_64 with file_limit => 'infinity' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:11:2] # rabbitmq on debian-8-x86_64 with file_limit => 'infinity' should contain File[/etc/default/rabbitmq-server] with content =~ /ulimit -n infinity/
rspec ./spec/classes/rabbitmq_spec.rb[1:9:11:3] # rabbitmq on debian-8-x86_64 with file_limit => 'infinity' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:12:1] # rabbitmq on debian-8-x86_64 with file_limit => '-1' should not contain File[/etc/security/limits.d/rabbitmq-server.conf]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:12:2] # rabbitmq on debian-8-x86_64 with file_limit => '-1' should contain File[/etc/default/rabbitmq-server] with content =~ /ulimit -n -1/
rspec ./spec/classes/rabbitmq_spec.rb[1:9:12:3] # rabbitmq on debian-8-x86_64 with file_limit => '-1' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:13:3] # rabbitmq on debian-8-x86_64 with file_limit => '1234' should not contain Systemd::Service_limits[rabbitmq.service]
rspec ./spec/classes/rabbitmq_spec.rb[1:9:19:1] # rabbitmq on debian-8-x86_64 on systems without systemd should not contain Systemd::Service_limits[rabbitmq.service]

@JayH5
Copy link
Contributor Author

JayH5 commented May 16, 2018

@bastelfreak thanks.. I must've been misreading 😓

@wyardley
Copy link
Contributor

@JayH5 I don't think this can work with the current systemd module.
Did you see my comments in:
#683 (comment)
Since it doesn't seem like that will be fixed soon, probably needs to be implemented w/o the systemd module.

@bastelfreak
Copy link
Member

@wyardley I am happy to fix this in the systemd module. I would like to merge voxpupuli/puppet-systemd#81 first and afterwards add support for -1 and unlimited

@bastelfreak
Copy link
Member

I am going to close this in favour of #715

bastelfreak added a commit that referenced this pull request Sep 5, 2018
Rebase of #683 / mock systemd fact properly
}

if $facts['systemd'] { # systemd fact provided by systemd module
systemd::service_limits { 'rabbitmq.service':

Choose a reason for hiding this comment

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

Shouldn't this use $::rabbitmq::service_name?

On Debian Stretch, the Service is called "rabbitmq-server.service" - but with "rabbitmq.service", the override does not get applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-work not ready to merge just yet tests-fail
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants