HI Bert,

Exists should be checking the @property_hash object which is populated by
the instances method.

Something like:

def exists?
  @property_hash[:ensure] == :present
end

Trevor

On Mon, Jul 10, 2017 at 9:24 AM, bert hajee <[email protected]> wrote:

> Hallo,
>
> I'm using the puppet module transition to help me out a nasty puppet
> definition situation. But I noticed it sometimes is not idempotent. We
> noticed this on a very complex custom type. To make sure the issue is a
> clear as can be, we extracted the minimal type/and provider to simulate
> this. Here
> <https://github.com/enterprisemodules/error_type/tree/transition_problems>
> you can find the type/provider code
>
> Here is some simple example code, based on a simple custom type:
>
>
>   transition { 'transition':
>     resource   => File['/a.a'],
>     attributes => {
>       content  => 'temp',
>     },
>     prior_to   =>  Error_type['a']
>   }
>
> file{'/a.a':
>   ensure => 'present',
>   content => 'aa',
> }
>
> error_type {'a':
>   ensure => 'present',
>   prop => 'aaa'
> }
>
> Using this example code, I noticed that the exists? is called before
> prefetching is done. Before using this module, I was under the impression
> the exists? method was only called later in the sequence. Therefore my
> exists? method was based on prefetched information.
>
> Do I:
>
>    - register a bug/question in the module?
>    - change the type/provider implementation to check if the specific
>    resource is already prefetched (would probably need to be done for a lot
>    more types/and providers)
>    - register a bug/question for puppet, making sure the prefetch is
>    ALWAYS called before exists?
>
>
> All suggestions are welcome!
>
> Regards,
>
> Bert
>
>
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-dev/94724428-5db3-4409-b710-9e2847bd1c47%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-dev/94724428-5db3-4409-b710-9e2847bd1c47%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699 x788

-- 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoXdvfF%2BOG9ev6VQHLBRTLOMNe-%3D3f%3Du7r8dkhOdRtewYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to