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

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/294ee254-71ad-43c0-8d40-ac0644c74805%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to