-
Notifications
You must be signed in to change notification settings - Fork 28
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
init.d support #2
Conversation
Looks good to me, thanks! I'll merge as soon as I run a test (probably tomorrow). |
@kimor79 I'm wondering if we should auto-detect the template to use based on the service_provider. What are your thoughts on that? |
Yes that would be better. I've got some other changes in the works in regards to defaults on CentOS (pid location, etc) so I'll see if I can do that as well. |
I was thinking something like this in params.pp: $service_file = $service_provider ? {
redhat => '/etc/init.d/uwsgi',
upstart => '/etc/init/uwsgi.conf',
}
$service_file_mode = $service_provider ? {
redhat => '0555',
upstart => '0644',
}
$service_template = $service_provider ? {
redhat => 'uwsgi/uwsgi_server-redhat.erb',
upstart => 'uwsgi/uwsgi_upstart.conf.erb',
} But the problem I'm running into is that those variables aren't changed from 'upstart' since $server_provider [when not the default value] gets set from init.pp. |
Yes I see the issue. You'd have to do the resolution within init.pp unless we change the params defaults to be OS based (which is probably a good idea to be honest). The problem would be changing the service provider and template within params, and it being backwards incompatible. I think the solution here is to undef the majority of parameters in init.pp, and only use defaults from params.pp when there is no user supplied parameters. We can then do service provider based resolution of the template and file mode within init.pp if they are undef'd, and trust the user selection if they are provided. I'm probably asking a little much though. If you'd like to have a go I'd be more than happy to merge. Otherwise, I can merge what you've already provided, and I can finish off the service based defaults. |
This is so one doesn't have to manually configure all $service_ variables but still can if they desire.
This patch works for me using init.d on CentOS and should allow for other service providers to be configured manually while still retaining backwards compat (I haven't actually tested). |
Thanks @kimor79 for the patch. I'll make a slight change so that the auto-set behaviour for non redhat or upstart providers doesn't result in empty variables, by replacing the ? upstart with ? default. |
This allows one to use init.d instead of upstart for service management. Ie in hiera:
uwsgi::service_file: /etc/init.d/uwsgi
uwsgi::service_file_mode: '0555'
uwsgi::service_provider: redhat
uwsgi::service_template: uwsgi/uwsgi_service-redhat.erb