- From: "Mark J. Reed" <
>
- To: "
" <
>
- Subject: [chef] Re: LWRPs as containers
- Date: Tue, 19 Apr 2011 13:36:16 -0400
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ehZrFOsyMedZIQwuvSnjM+qmsD06tXMUcJ9PGdj+U0bjqNbClbDWZtplVgKONXRPeI sCQi5ogmIno0ISGlt1GiBNifgarlaLfv2PXYbzYNM/ZL8PJ450SXVLKFEh5fBAlO1toI jcYZt8H5jxqCcvX4Z7IFnwkRs16IBlKHYuzkE=
Thanks, Adam. I got it working with kallistec's help on IRC. What
I'm doing now is just duplicating the notifies from the LWRP onto each
sub resource.
Ex code (abbreviated due to typing on phone):
action :create do
nr = new_resource
@delay = nr.delayed_notifications
@imm = nr.immediate_notifications
def fw(res)
if @delay then
@delay.each do |r|
res.notifies_delayed r.action, r.resource
end
end
if @imm then ... #similar
end
end
fw( remote_file "foo" do ... end )
fw( bash "bar" do ... end )
...
end
Direct setters for the notifications attributes would be helpful here...
On Tuesday, April 19, 2011, Adam Jacob
<
>
wrote:
>
On Tue, Apr 19, 2011 at 8:13 AM, Mark J. Reed
>
<
>
>
wrote:
>
> I have an LWRP that fundamentally just creates a bunch of other
>
> resources dynamically. I had some issues getting notifies to work, so
>
> I have some questions.
>
>
>
> 1. Is an LWRP the best way to create a resource that is really a
>
> collection of other resources?
>
>
>
> 2. If not, what is? A define? A straight-up non-lightweight resource
>
> definition? It's definitely not a recipe, as I need to be able to
>
> call/include it multiple times with different parameters.
>
>
>
> 3. If it's at least a reasonable way to do it, where in the provider
>
> does that logic belong? Creating more resources once you're already
>
> running the action seems a bit late; I wind up having to call
>
> run_action on them as I create them in order to get the behavior I
>
> want.
>
>
>
> 4. As far as notifies go, is there a way from the provider to access
>
> the set of notifications requested?
>
>
>
> Any thoughts and recommendations appreciated. Thanks!
>
>
Can you give us some example code, and tell us what's happening with
>
the notifications?
>
>
Adam
>
>
--
>
Opscode, Inc.
>
Adam Jacob, Chief Product Officer
>
T: (206) 619-7151 E:
>
>
--
Mark J. Reed
<
>
Archive powered by MHonArc 2.6.16.