Is your code published?  You should be using a util class loaded by
both the function and the type, and it doesn't look like you are.

-- 
Luke Kanies | +1-615-594-8199

On Mar 22, 2011, at 5:45 PM, Trevor Vaughan <tvaug...@onyxpoint.com> wrote:

> Ok, so after futzing around with that for a while, I came up with a
> solution, but it feels...well...bad.
>
> In my custom type, I do the following:
>
> s = Puppet::Parser::Scope.new
> Puppet::Parser::Functions.autoloader.loadall
>
> I can then call my function with s.function_functionname(args)
>
> What are the ramifications of this?
>
> Thanks,
>
> Trevor
>
> On Tue, Mar 22, 2011 at 8:10 PM, Trevor Vaughan <tvaug...@onyxpoint.com> 
> wrote:
>> Hmm...I spoke too soon.
>>
>> Adding the util directory allows the custom function to call it with
>> no problem however the custom type says that the call is an
>> uninitialized constant.
>>
>> I've tried pretty much everything that I can think of while still
>> keeping this in a module.
>>
>> Any examples?
>>
>> Thanks,
>>
>> Trevor
>>
>> On Tue, Mar 22, 2011 at 7:33 PM, Trevor Vaughan <tvaug...@onyxpoint.com> 
>> wrote:
>>> Ok, you made that too easy....
>>>
>>> Thanks!
>>>
>>> Trevor
>>>
>>> On Tue, Mar 22, 2011 at 7:08 PM, Luke Kanies <l...@puppetlabs.com> wrote:
>>>> It should generally work in a module, yes.
>>>>
>>>> On Mar 22, 2011, at 4:06 PM, Trevor Vaughan wrote:
>>>>
>>>>> Does that work in a module, or would I be placing that into the normal
>>>>> util space?
>>>>>
>>>>> I'm trying to keep everything in a module.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Trevor
>>>>>
>>>>> On Tue, Mar 22, 2011 at 7:02 PM, Luke Kanies <l...@puppetlabs.com> wrote:
>>>>>> On Mar 22, 2011, at 3:34 PM, Trevor Vaughan wrote:
>>>>>>
>>>>>>> All,
>>>>>>>
>>>>>>> I'm trying to figure out if I can call a custom function that I've
>>>>>>> written from a custom type that I'm writing.
>>>>>>>
>>>>>>> Basically, I'm trying to reuse code and not repeat it all in the type.
>>>>>>
>>>>>> Kind of, assuming that it's all distributed on the client, but it's a 
>>>>>> big pain.
>>>>>>
>>>>>> I recommend instead that you create a support library in util/ or 
>>>>>> something and call out to that from both places.
>>>>>>
>>>>>> --
>>>>>> Don't hit at all if it is honorably possible to avoid hitting; but
>>>>>> never hit soft!       -- Theodore Roosevelt
>>>>>> ---------------------------------------------------------------------
>>>>>> Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Puppet Developers" group.
>>>>>> To post to this group, send email to puppet-dev@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to 
>>>>>> puppet-dev+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at 
>>>>>> http://groups.google.com/group/puppet-dev?hl=en.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Trevor Vaughan
>>>>> Vice President, Onyx Point, Inc
>>>>> (410) 541-6699
>>>>> tvaug...@onyxpoint.com
>>>>>
>>>>> -- This account not approved for unencrypted proprietary information --
>>>>
>>>>
>>>> --
>>>> You wake me up early in the morning to tell me I am right? Please
>>>> wait until I am wrong.      -- Johann von Neumann
>>>> ---------------------------------------------------------------------
>>>> Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "Puppet Developers" group.
>>>> To post to this group, send email to puppet-dev@googlegroups.com.
>>>> To unsubscribe from this group, send email to 
>>>> puppet-dev+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at 
>>>> http://groups.google.com/group/puppet-dev?hl=en.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Trevor Vaughan
>>> Vice President, Onyx Point, Inc
>>> (410) 541-6699
>>> tvaug...@onyxpoint.com
>>>
>>> -- This account not approved for unencrypted proprietary information --
>>>
>>
>>
>>
>> --
>> Trevor Vaughan
>> Vice President, Onyx Point, Inc
>> (410) 541-6699
>> tvaug...@onyxpoint.com
>>
>> -- This account not approved for unencrypted proprietary information --
>>
>
>
>
> --
> Trevor Vaughan
> Vice President, Onyx Point, Inc
> (410) 541-6699
> tvaug...@onyxpoint.com
>
> -- This account not approved for unencrypted proprietary information --
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Developers" group.
> To post to this group, send email to puppet-dev@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to