It sounds like a fairly standard situation: every time the template changes, you want the application uninstalled and reinstalled.
So a notify from the template to the execute resource is still the proper thing to do. Just be sure to have the right error handling in place so that if the application isn’t installed yet, the recipe will still do the right thing.
Will chef be running in the background, or in the context of the user who runs the application? If chef is not running in the context of the user who runs the program, it may be difficult to properly stop and restart it (especially because you would have to take into account the possibility that the user isn’t even logged in, and/or that the application wasn’t running).
From:email@example.com mailto:firstname.lastname@example.org <email@example.com mailto:firstname.lastname@example.org >
Sent: Friday 19th April 2013 7:11
To: email@example.com mailto:firstname.lastname@example.org
Subject: [chef] Windows Application Resource Notifications
I have a use case on Windows where my recipe has a template that is used by a
subsequent “execute” resource to start an application (via a custom
non-InstallShield setup.exe). Normally, I would add a notification from the
template to the execute’s :run action. In this case, though, the application
isn’t a service that I’d cycle. In fact, I’m not entirely sure the behavior if
I reran the setup.exe with a different template. The only sure way I know to
guarantee the correct behavior is to stop the application (somehow), uninstall
it, and install it again.
Is there any general best practice I should be following? What are others
doing in these cases? Is it just a limitation of the Windows platform and/or
my application that this won’t work?