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? -- 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.
