-
Notifications
You must be signed in to change notification settings - Fork 270
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
Fixes #18757 - Move foreman-tasks service to Foreman #530
Conversation
f6171f4
to
acfdc6e
Compare
Any reason it has to live in Other than that we generally keep compatibility with older Foreman versions (current and current - 1 is what we at least aim for) or bump the major version. The current implementation breaks on 1.14 without foreman-tasks so it needs to deal with this. |
manifests/tasks_service.pp
Outdated
$service = $::foreman::params::tasks_service, | ||
) inherits foreman::params { | ||
service { 'foreman-tasks': | ||
ensure => running, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest pulling the variables out so you can overwrite them if you want.
Just move them to the "signature" of the class, similar to service.
@ekohl Actually no need to restart the tasks service AFAIK - that's not a problem. I see a small problem though if foreman 1.14 has to be supported. The situation is the following: On 1.14:
On 1.15:
To keep this module compatible with both versions it would require:
We thought about changing the
|
@mmoll What you suggested was having a parameter |
@dLobatog exactly. |
Updated to reflect the changes asked for @ekohl @mmoll & @timogoebel - I have to add tests for this |
manifests/plugin/tasks.pp
Outdated
) inherits foreman::plugin::tasks::params { | ||
if $dynflow_in_core == false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, cant you just use
unless $dynflow_in_core {
manifests/params.pp
Outdated
@@ -99,6 +99,7 @@ | |||
$init_config_tmpl = 'foreman.sysconfig' | |||
$puppet_etcdir = '/etc/puppet' | |||
$puppet_home = '/var/lib/puppet' | |||
$tasks_service = 'foreman-tasks' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we should not call it foreman-tasks
manifests/tasks_service.pp
Outdated
@@ -0,0 +1,28 @@ | |||
# = foreman-tasks service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick about the name, imho dynflow or background-jobs makes sense not to confuse with task plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer to name it foreman::service::tasks
(or jobs).
manifests/tasks_service.pp
Outdated
$ensure = $::foreman::params::tasks_service_ensure, | ||
$enable = $::foreman::params::tasks_service_enable, | ||
) inherits foreman::params { | ||
service { 'foreman-tasks': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: use the parameter?
55cdc15
to
2cd459d
Compare
please check the test errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a section in the README with compatibility notes. We typically describe parameters like dynflow_in_core
there with a note how 1.14 users should continue using this module.
Given these changes, we should also bump the major version after merging this. That should be a different commit and can be done in a separate PR.
manifests/plugin/tasks.pp
Outdated
enable => true, | ||
name => $service, | ||
} | ||
unless $dynflow_in_core { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this parameter is actually needed. Given there's an include in foreman::service
if it's true that means it's going to be included anyway.
You're also losing the notify on the service if the plugin changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is precisely for the opposite thing - if it's false, I don't want to include the tasks service as it's not necessary to restart it when foreman-tasks was installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is: if it's true, it's included anyway (through foreman::service
). Here you also ensure it's included if it's false. Doesn't that mean you can unconditionally include it?
|
||
describe 'foreman::tasks_service' do | ||
let :facts do | ||
on_supported_os['redhat-7-x86_64'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this code is relevant for every distro where we run Foreman, I'd feel more comfortable if this was tested on more platforms. We've already seen that there are subtle problems with dependencies if we take these shortcuts.
5ca06c8
to
abe98eb
Compare
manifests/plugin/remote_execution.pp
Outdated
|
||
foreman::plugin {'remote_execution': | ||
notify => Service['foreman-tasks'], | ||
notify => Service[$::foreman::params::tasks_service], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if that parameter is overridden?
what's the name of service? it'll come with the RPM/DEB package, correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct now. @mmoll could you have a look again?
README.md
Outdated
@@ -51,6 +51,7 @@ previous stable release. | |||
|
|||
### Foreman version compatibility notes | |||
|
|||
For Foreman 1.15 or older, please set the 'dynflow_in_core' parameter to false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.16
manifests/service/jobs.pp
Outdated
@@ -0,0 +1,35 @@ | |||
# = Jobs service | |||
# | |||
# Service to start a Dynflow executorfor background job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excutor for
# On foreman 1.16+ this runs the dynflow-executor. This class could be | ||
# renamed to dynflow-executor when this module has to be compatible with | ||
# 1.16 and 1.17 only | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version updates needed also here
it { should contain_foreman__plugin('remote_execution').that_notifies("Class[foreman::service::jobs]") } | ||
end | ||
|
||
context "in 1.15 or lower, tasks is included" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.16
looking good, but I first want to have the change done in nightly packages (after 1.16 RC1 would be good, I think). |
What's the status of the packaging? Can this be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now it's only pending theforeman/foreman-packaging#1549? |
@dLobatog sadly this needs another rebase |
As per #18618, the dynflow executor is moving over to Foreman, in order to support ActiveJob. Tasks will provide an UI and persistence layer for Dynflow, but Foreman should be able to run jobs without it too. Part of this effort includes moving the Dynflow executor over to Foreman, which at the moment is managed by the foreman-tasks service. Change contain to notify Conflicts: manifests/plugin/tasks.pp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased with the latest master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll send you a patch with suggestions.
@@ -51,6 +51,7 @@ previous stable release. | |||
|
|||
### Foreman version compatibility notes | |||
|
|||
For Foreman 1.16 or older, please set the 'dynflow_in_core' parameter to false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to get this in 1.16, this should be 1.15 or older
@@ -5,6 +5,7 @@ | |||
$ssl = $::foreman::ssl, | |||
) { | |||
anchor { ['foreman::service_begin', 'foreman::service_end']: } | |||
contain ::foreman::service::jobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be surrounded by if $dynflow_in_core {
and added added to the class parameters.
@@ -102,6 +104,8 @@ | |||
$init_config_tmpl = 'foreman.sysconfig' | |||
$puppet_etcdir = '/etc/puppet' | |||
$puppet_home = '/var/lib/puppet' | |||
$jobs_service = $dynflow_in_core ? { true => 'dynflow-executor', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since here $dynflow_in_core
is always true, you can just write $jobs_service = 'dynflow-executor
. If you want to dynamically determine this it should be in the foreman::service::jobs
class. I'd recommend $jobs_service = undef
here and then determine it later.
Closing since the replacement PR was merged. |
As per #18618, the dynflow executor is moving over to Foreman, in order
to support ActiveJob. Tasks will provide an UI and persistence layer for
Dynflow, but Foreman should be able to run jobs without it too.
Part of this effort includes moving the Dynflow executor over to
Foreman, which at the moment is managed by the foreman-tasks service.
theforeman/foreman#4316 has to be merged before this