Re: [Puppet Users] Is there a way to find unused puppet code (2.7)?

2014-02-09 Thread Henrik Lindberg

On 2014-09-02 2:53, Amos Shapira wrote:

Hello,

Is there a way to systematically find all modules we have which aren't used?

Basically, the answer is no because it is not possible to statically 
analyze puppet code since all inputs are unknown. (This because 
references to types can be dynamic - i.e. based on combination of values 
that are only present when evaluation takes place).


At best, it is possible to find candidates that *may* be removed, but 
only with knowledge that there are no dynamic references, and/or after 
testing.


Having a tool that finds modules that a given module depends on but 
without anything actually being used is a great tool to have - suggest 
filing an enhancement request for Geppetto for this. (It will still not 
be able to tell you if there are dynamic references - only testing

can answer that).

Regards
- henrik


--
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/ld8aqp%24h04%241%40ger.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Is there a way to find unused puppet code (2.7)?

2014-02-09 Thread gh
On 2/8/14 8:53 PM, Amos Shapira wrote:
 Hello,
 
 Is there a way to systematically find all modules we have which aren't used?
 
 Two reasons for this question:
 
  1. We use librarian-puppet to manage external modules and would like
 to find which of them can we remove.
  2. We did some major refactoring over the years, in particular we moved
 from a mix of old distribution to a single Ubuntu LTS version, and
 there could be some of our own classes which aren't used.
  3. If it's an automatic way, it will be great to run it as part of our
 Continuous Integration suite to find code which can be removed.
 
 So - is there such a thing?
 
 Cheers,
 
 --Amos


Hi Amos,

With PuppetDB you can query[1] for the most recent catalog of a given
node which will list all of the classes used. You could the use the
process of elimination to see what classes you had in your modulepath
that are not showing up in your catalogs.

[1] - http://docs.puppetlabs.com/puppetdb/1.6/api/query/v3/catalogs.html

BR,
-g

--
Garrett Honeycutt
learnpuppet.com

-- 
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/52F7B043.7030308%40garretthoneycutt.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Is there a way to find unused puppet code (2.7)?

2014-02-09 Thread Henrik Lindberg

On 2014-09-02 17:36, Henrik Lindberg wrote:

On 2014-09-02 2:53, Amos Shapira wrote:

Hello,

Is there a way to systematically find all modules we have which aren't
used?


Basically, the answer is no because it is not possible to statically
analyze puppet code since all inputs are unknown. (This because
references to types can be dynamic - i.e. based on combination of values
that are only present when evaluation takes place).

At best, it is possible to find candidates that *may* be removed, but
only with knowledge that there are no dynamic references, and/or after
testing.

Having a tool that finds modules that a given module depends on but
without anything actually being used is a great tool to have - suggest
filing an enhancement request for Geppetto for this. (It will still not
be able to tell you if there are dynamic references - only testing
can answer that).



I logged a feature issue for Geppetto - 
https://tickets.puppetlabs.com/browse/PUP-1625


Regards
- henrik


--
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/ld9bva%24cbg%241%40ger.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Is there a way to find unused puppet code (2.7)?

2014-02-08 Thread Amos Shapira
Hello,

Is there a way to systematically find all modules we have which aren't used?

Two reasons for this question:

   1. We use librarian-puppet to manage external modules and would like 
   to find which of them can we remove.
   2. We did some major refactoring over the years, in particular we moved 
   from a mix of old distribution to a single Ubuntu LTS version, and there 
   could be some of our own classes which aren't used.
   3. If it's an automatic way, it will be great to run it as part of our 
   Continuous Integration suite to find code which can be removed.

So - is there such a thing?

Cheers,

--Amos

-- 
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/3481c943-4b09-4029-ad98-8f2906023340%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Is there a way to find unused puppet code (2.7)?

2014-02-08 Thread José Luis Ledesma
I was thinking about this too.

If your servers checkin every 30 minutos you can do:
find /path/to/modules  -amin +30

I have not tried it yet,but I suppose it works

Regards,
El 09/02/2014 02:53, Amos Shapira amos.shap...@gmail.com escribió:

 Hello,

 Is there a way to systematically find all modules we have which aren't
 used?

 Two reasons for this question:

1. We use librarian-puppet to manage external modules and would like
to find which of them can we remove.
2. We did some major refactoring over the years, in particular we
moved from a mix of old distribution to a single Ubuntu LTS version, and
there could be some of our own classes which aren't used.
3. If it's an automatic way, it will be great to run it as part of our
Continuous Integration suite to find code which can be removed.

 So - is there such a thing?

 Cheers,

 --Amos

 --
 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/3481c943-4b09-4029-ad98-8f2906023340%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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/CAF_B3de-PM_sORn160YXDKkiZX5%2ByCgjSA8pz8LOvdZ05Pq0MA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Is there a way to find unused puppet code (2.7)?

2014-02-08 Thread Amos Shapira
I don't think it'll work, even though my servers do check in every 30 
minutes:

   1. From what I understand, the puppet master caches the manifest and 
   doesn't re-interpret it unless it changed.
   2. I have atime disabled on my servers. It saves tons of disk IO and is 
   even the default on our platform (Ubuntu 12.04 LTS).

I have a gut feeling that once Puppet interprets the manifest, it holds a 
tree of objects somewhere were I can scan and look for mention of every 
class in my Puppet source. I just found /var/lib/puppet/state/state.yaml, 
which has an entry for resource, including classes. Perhaps that's the 
direction to go but I was wondering whether there is already a tool to do 
that.

On Sunday, 9 February 2014 18:42:01 UTC+11, Jose Luis Ledesma wrote:

 I was thinking about this too. 

 If your servers checkin every 30 minutos you can do:
 find /path/to/modules  -amin +30 

 I have not tried it yet,but I suppose it works

 Regards,
 El 09/02/2014 02:53, Amos Shapira amos.s...@gmail.com javascript: 
 escribió:

 Hello,

 Is there a way to systematically find all modules we have which aren't 
 used?

 Two reasons for this question:

1. We use librarian-puppet to manage external modules and would 
like to find which of them can we remove. 
2. We did some major refactoring over the years, in particular we 
moved from a mix of old distribution to a single Ubuntu LTS version, and 
there could be some of our own classes which aren't used. 
3. If it's an automatic way, it will be great to run it as part of 
our Continuous Integration suite to find code which can be removed.

 So - is there such a thing?

 Cheers,

 --Amos

 -- 
 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...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/3481c943-4b09-4029-ad98-8f2906023340%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
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/02bfc2de-899b-4e54-a5e2-216bfb205b1b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.