I’m not sure exactly what happens, but you can sidestep the issue simply by using two different resource names, and specifying the actual service name with the service_name attribute.
-----Original message-----
From: Koert Kuipers koert@tresata.com
Sent: Tuesday 27th January 2015 11:47
To: chef@lists.opscode.com
Subject: [chef] define same service multiple times
what happens if i define the same service multiple times across recipes?
for example:
i define it once just so i can have it restart if a template changes (but in that recipe i do not enable or start it)
i define it again in another recipe to enable and start it.
do these multiple definitions get merged somehow? what if they conflict?
On Tuesday, January 27, 2015 at 1:16 PM, Kevin Keane Subscription wrote:
RE: [chef] define same service multiple times
I'm not sure exactly what happens, but you can sidestep the issue simply by using two different resource names, and specifying the actual service name with the service_name attribute.
what happens if i define the same service multiple times across recipes?
for example:
i define it once just so i can have it restart if a template changes (but in that recipe i do not enable or start it)
i define it again in another recipe to enable and start it.
do these multiple definitions get merged somehow? what if they conflict?
thanks! koert
You get a behavior called resource cloning, which triggers a warning (and we’d like to remove sometime, though this is kinda tricky to do). You can read more about that here: https://tickets.opscode.com/browse/CHEF-3694
In any case, you’re best off following Kevin’s advice.
On Tue, Jan 27, 2015 at 4:25 PM, Daniel DeLeo dan@kallistec.com wrote:
On Tuesday, January 27, 2015 at 1:16 PM, Kevin Keane Subscription wrote:
RE: [chef] define same service multiple times
I'm not sure exactly what happens, but you can sidestep the issue simply
by using two different resource names, and specifying the actual service
name with the service_name attribute.
what happens if i define the same service multiple times across
recipes?
for example:
i define it once just so i can have it restart if a template changes
(but in that recipe i do not enable or start it)
i define it again in another recipe to enable and start it.
do these multiple definitions get merged somehow? what if they
conflict?
thanks! koert
You get a behavior called resource cloning, which triggers a warning (and
we’d like to remove sometime, though this is kinda tricky to do). You can
read more about that here: https://tickets.opscode.com/browse/CHEF-3694
In any case, you’re best off following Kevin’s advice.