What I'm trying for is to do something like the following:

module Puppet newtype(:myfile, :parent => Puppet::Type.type(:file)) do

  # This should just magically "do the right thing"
  newproperty(:content) do
     defaultto do
       provider.run_some_command
     end
  end

end

Basically, I want everything to stay the same but to have a default for the
content based on running particular commands on the system and validating
the output.

It doesn't necessarily need to be this way, but I keep rewriting parts of
the file type for different purposes and it seemed a bit silly.

I suppose, if the methods that make up the file type and provider were a
class, that might work better. Then I could simply pick and choose what
parts I need to use as necessary.

Part of my issue is how to tie the type and provider back to each other
with the inheritance techniques.

It's certainly possible that this just isn't possible the way things are
right now.

Thanks,

Trevor

On Tue, Feb 19, 2013 at 12:43 AM, Luke Kanies <[email protected]> wrote:

> On Feb 18, 2013, at 5:55 PM, Trevor Vaughan <[email protected]>
> wrote:
>
> I've been playing with how to do this but nothing obvious is working.
>
> I can specify the parent for both the type and provider but the methods,
> parameters, and properties don't seem to come along for the ride.
>
> In particular, I want everything that the File type currently provides but
> to override a few items with system-gathered materials.
>
> In this case a fact won't work due to the amount of data being
> transferred/compared.
>
>
> I don't think you realistically can.
>
> The Tidy type used to be a subclass of File, but I don't think it is any
> more.  I think that was the only subclass out there, and I would be
> surprised if subclassing were remotely simple to get what you wanted out of.
>
> I think the File provider is probably actually nowhere near what it needs
> to be, so I don't think you get anything for subclassing it.
>
> That being said, what are you trying for, and how are you actually trying
> it?  The methods should certainly transfer, and I think the parameters
> should, too.
>
> --
> Luke Kanies | http://about.me/lak | http://puppetlabs.com/ |
> +1-615-594-8199
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
[email protected]

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to