Thanks for the reply.
First and foremost, as you mention, the networking case is problematic in other ways. Thinking about it a little bit more, the issue seems to be more about correlating the existing interfaces in the kernel with the config as chef sees it. The config comes from multiple places, primarily /etc/networking/interfaces but also heartbeat. That correlation seems pretty complex and I’m not sure how to address it with chef, if it’s possible. A configuration change can cause removal/creation of virtual interfaces. Adding an interfaces doesn’t seem too hard but removing one does, since I’d have to have code that knew how many interfaces there were in the old config. Or am I missing something?
Second, as to the example you gave, the part that differs from what I was looking for is that I was hoping for a mechanism that would use the built-in file diffing to determine/coordinate the shutdown/restart.
On Jul 14, 2011, at 11:26 PM, Joshua Timberman wrote:
On Thu, Jul 14, 2011 at 12:22 PM, Steven Parkes firstname.lastname@example.org wrote:
Sorry if this is covered elsewhere, but I’m wondering if there is/shouldn’t be a way to stop a service before making config file changes, rather than restarting afterwards.
An example is networking: I want to stop it using the old config and then start it with the new config. Otherwise, it gets confused because the number of interfaces may have changed. Doing a stop with the new config file is not the same thing as doing a stop with the old config.
Unless there’s another/better way to do this …
Sure, you can reuse the same named resource and send it multiple
actions. You’ll want a conditional that wraps the recipe so it doesn’t
occur (stop networking) unless necessary). For example, we do this in
the mysql::server_ec2 recipe to move the data directory of MySQL to
ephemeral storage (or an EBS volume depending on the attribute
Though for networking I’d want to be very careful about how this is
handled as it may be …problematic if there’s an error.
Joshua Timberman, Director of Training and Services
IRC, Skype, Twitter, Github: jtimberman