On Fri, May 4, 2012 at 1:46 PM, Philip Brown <[email protected]> wrote:

>
>
> On Friday, May 4, 2012 1:29:19 PM UTC-7, Luke Kanies wrote:
>
>> On May 4, 2012, at 11:08 AM, Philip Brown wrote:
>>
>> ....
>>
>> I dont see how to send some kind of message to the logs, "hey, something
>> changed, but I'm fixing it".
>>
>>
>> In all cases I can think of, Puppet will do the appropriate logging, so
>> you only need to worry about extra information like debugging.
>>
>> E.g., if you are using 'ensure' present, then when the transaction
>> successfully calls 'ensure' on the provider, it will create an Event that
>> has the property set to 'ensure', the previous_value set to 'absent', and
>> the current_value set to 'present' (or something like that).  Then this
>> Event calls the 'notice' log method with the appropriate log message.
>>
>> So, your provider should focus 100% on function, and throwing errors
>> where it can't do what it is supposed to, and the transaction should handle
>> all logging and error management.
>>
>> In case it's not clear, you should very rarely have a conditional like
>> you do with the 'exists?' method above - return true if it's there, false
>> if it's not, but don't return a string.  The system will treat the string
>> as true, but that's probably not what you want.
>>
>
> Okay, so looks like i picked a bad example. Thank you for your informative
> stuff: "exists?" must return either "absent" or "present".
> But.. what about create routines then?
> What's the internal flow ? something like:
> * puppet calls exists?
> * if it returns absent, call create
> * puppet calls exists? again to verify
> * puppet decides what message to log?
>


The main thing that Puppet really 'logs' is state transitions. (it also
logs command on debug, but the thing it is really designe to do is describe
system state transitions)

- it a resource exists and is ensurable,
- then resource can use the ensure property to describe if the thing should
exist
- exists will be used to query if the thing currently exists
  - true means it currently exists on the system
  - false indicates it does not
- if the resource was specified as being in the ensure state present, then
if the thing does not exist, then create will be called to ensure that it
is in the state of present

If this process occurs, the Puppet should log the state transition

      This resource was purged, now its present



>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-dev/-/hIaCGhTtRO4J.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to