- From: Sean OMeara <
>
- To: "
" <
>
- Subject: [chef] Re: RE: Re: Custom LWRP Initialise Error
- Date: Thu, 24 Jul 2014 08:50:15 -0500
If you want to explicitly name the resource instead of having it
auto-inferred by the LWRP DSL, you'll have to make a library and do
this:
https://github.com/opscode-cookbooks/motd-tail/blob/master/libraries/resource_motd_tail.rb#L22-L23
-s
On Thu, Jul 24, 2014 at 8:46 AM,
<
>
wrote:
>
Hi Julian,
>
Resource file is called dlldrop.rb, provider is the same name.
>
Cookbook is called AW_DllDrop
>
>
I think I was over-complicating it with the current-resource blocks, this
>
cookbook is only run in the event of a dll drop needing to be performed so
>
idempotence is not that important.
>
I've trimmed it a bit and got it working, I think my mistake was using
>
Chef::Resource::dlldrop when there appears to be no need at all to do that.
>
>
I'm working on a similar one to find services and stop them and running
>
into the same thing.
>
>
Thanks
>
>
-----Original Message-----
>
From: Julian C. Dunn
>
[mailto:
>
Sent: 24 July 2014 14:27
>
To:
>
>
Subject: [chef] Re: Custom LWRP Initialise Error
>
>
I assume your custom resource is in a cookbook called "dll" with the
>
filename "drop.rb", right?
>
>
- Julian
>
>
On Thu, Jul 24, 2014 at 7:10 AM,
>
>
>
<
>
>
wrote:
>
> Morning Guys
>
>
>
>
>
>
>
> Got a question about LWRP’s. I’m writing a library cookbook and
>
> testing components of it as I go.
>
>
>
> I’ve written an LWRP to perform a dll drop on a server.
>
>
>
> Everything seems ok, I’ve done a lot of reading online about this and
>
> managed to narrow it down to this last error.
>
>
>
> The error is:
>
>
>
> “[2014-07-24T06:59:57-04:00] FATAL: NameError:
>
> AW_DLLDrop_dlldrop[7.1_HF05_Overlay_SAML_fix.zip] (AW_DLLDrop::default
>
> line
>
> 25) had an error: NameError: uninitialized constant
>
> Chef::Resource::DllDrop”
>
>
>
>
>
>
>
> The code from the LWRP in question is:
>
>
>
> “
>
>
>
> def whyrun_supported?
>
>
>
> true
>
>
>
> end
>
>
>
>
>
>
>
> action :drop do
>
>
>
> converge_by("Drop #{ @new_resource}") do
>
>
>
> perform_dll_drop
>
>
>
> end
>
>
>
> end
>
>
>
>
>
>
>
> action :undo do
>
>
>
> converge_by("Undo #{ @new_resource}") do
>
>
>
> undo_dll_drop
>
>
>
> end
>
>
>
> end
>
>
>
>
>
>
>
> def load_current_resource
>
>
>
> @current_resource =
>
> Chef::Resource::DllDrop.new(@new_resource.name)
>
>
>
> @current_resource.name(@new_resource.name)
>
>
>
> end”
>
>
>
>
>
>
>
> Can anyone shed any light on what I’m missing with this? One of my
>
> colleagues has pointed out that there may be an issue with
>
> @new_resource.name retuning null? Any way I can check this?
>
>
>
>
>
>
>
> Any pointers would be great as I’m struggling a little with this.
>
>
>
>
>
>
>
> Thanks
>
>
>
> Chris
>
>
>
>
--
>
[ Julian C. Dunn
>
<
>
>
* Sorry, I'm ]
>
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
>
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
>
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]
Archive powered by MHonArc 2.6.16.