On 8/21/14 5:45 PM, Manuel QuiƱones wrote: > Hello, > > I'm working on a utility script to track orphaned resources. With > orphans I mean: resources that were previously managed by Puppet, but > they no longer are. I want to track those while I do a refactor in my > manifests. > > Here is the script I wrote: > > https://gist.github.com/manuq/eec269ce7ba00974f46e > > It is based on some assumptions, and here is my question: are these > assumptions correct? > > - Puppet generates the following files on each run, even when called > with --noop: > - last_run_report.yaml: contains the resources currently managed, in > full detail (serialized Puppet objects) > - state.yaml: contains the resources Puppet ever managed since the file > was created, only their name and some timestamps "checked" and "synced" > - last_run_summary.yaml: among other things, contain the timestamp of > the run, and the total time it took > > Based on that, I have two methods that output the orphans: > > Method 1: use state.yaml and read the "checked" timestamp. If it was not > checked in the last run, then it is an orphan. > Method 2: orphans are the subset of resources that are contained in > state.yaml and are not contained in last_run_report.yaml. > > Critics and suggestions welcome. Also I hope this can be useful to others. > Cheers, > > PS Note that this topic was discussed earlier in May. I took it as > initial reference: > https://groups.google.com/forum/#!searchin/puppet-users/orphan/puppet-users/ghKfRBkPD5A/m7KTeymd2XwJ
Hi Manuel, Your plan is quite clever though if your goal is to refactor your puppet modules and not leave anything out, spec tests are the way to go. http://rspec-puppet.com/tutorial/ Best regards, -g -- Garrett Honeycutt @learnpuppet Puppet Training with LearnPuppet.com Mobile: +1.206.414.8658 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/53F66DE9.4020705%40garretthoneycutt.com. For more options, visit https://groups.google.com/d/optout.