Chef

Ability to specify service priority on action enable

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.7.2
  • Fix Version/s: 0.9.8
  • Component/s: Providers
  • Labels:
    None
  • Triage Status:
    Triaged

Description

Use case:

I installed a custom service using Chef that mounts EBS volumes and the postgresql package.

By default the custom service gets prio 20 and the postgresql service gets 19 on Ubuntu.
I need to mount the EBS volumes before starting the postgresql server that stores data on said volumes

Activity

Hide
Tollef Fog Heen added a comment - 05/Mar/10 10:00 PM

This is slightly more complicated than it looks at first.

I suggest an API similar to the following:

service "foo" do
priority 20
end

this will add foo to the default runlevels (2,3,4,5 on Debian/Ubuntu, possibly others on RH) with a start priority of 20 and add it to 0, 1 and 6 with a stop priority of 80.

Alternatively, if you want to do something more complex, you can do

service "foo" do
priority({ 0 => [ :start, 15 ], 1 => [ :stop, 55 ] })
end

This will add it to runlevel 0 with a start priority of 15 and runlevel 1 with a stop priority of 55.

Does this sound sane? What should we do in the case that a service provider does not support priorities (like upstart) or runlevels?

Show
Tollef Fog Heen added a comment - 05/Mar/10 10:00 PM This is slightly more complicated than it looks at first. I suggest an API similar to the following: service "foo" do priority 20 end this will add foo to the default runlevels (2,3,4,5 on Debian/Ubuntu, possibly others on RH) with a start priority of 20 and add it to 0, 1 and 6 with a stop priority of 80. Alternatively, if you want to do something more complex, you can do service "foo" do priority({ 0 => [ :start, 15 ], 1 => [ :stop, 55 ] }) end This will add it to runlevel 0 with a start priority of 15 and runlevel 1 with a stop priority of 55. Does this sound sane? What should we do in the case that a service provider does not support priorities (like upstart) or runlevels?
Hide
Adam Jacob added a comment - 24/Mar/10 5:44 AM

This is totally sane - the answer for what to do on providers that don't support priority is nothing at all - it's a no-op.

Show
Adam Jacob added a comment - 24/Mar/10 5:44 AM This is totally sane - the answer for what to do on providers that don't support priority is nothing at all - it's a no-op.
Hide
Tollef Fog Heen added a comment - 17/Jul/10 12:26 AM

Fixed in http://github.com/tfheen/chef/tree/CHEF-366, please test and merge.

Show
Tollef Fog Heen added a comment - 17/Jul/10 12:26 AM Fixed in http://github.com/tfheen/chef/tree/CHEF-366, please test and merge.
Hide
Daniel DeLeo added a comment - 19/Jul/10 11:06 PM

Thanks Tollef, this is merged and will be in the next release. One minor quibble: you don't need to use method stubs on resource classes in your tests--you can just set the value. We're actively trying to move away from that style in testing because it causes too many headaches.

Show
Daniel DeLeo added a comment - 19/Jul/10 11:06 PM Thanks Tollef, this is merged and will be in the next release. One minor quibble: you don't need to use method stubs on resource classes in your tests--you can just set the value. We're actively trying to move away from that style in testing because it causes too many headaches.
Hide
Daniel DeLeo added a comment - 06/Aug/10 11:34 PM

Have to reopen to set the fix version to 0.9.8. no need for alarm.

Show
Daniel DeLeo added a comment - 06/Aug/10 11:34 PM Have to reopen to set the fix version to 0.9.8. no need for alarm.
Hide
Daniel DeLeo added a comment - 06/Aug/10 11:35 PM

set fix version to 0.9.8. Wish I'd done this before writing the release announcement, would've been a nice feature to mention.

Show
Daniel DeLeo added a comment - 06/Aug/10 11:35 PM set fix version to 0.9.8. Wish I'd done this before writing the release announcement, would've been a nice feature to mention.

People

Vote (0)
Watch (1)

Dates

  • Created:
    12/Jun/09 6:47 AM
    Updated:
    06/Aug/10 11:35 PM
    Resolved:
    06/Aug/10 11:35 PM