Issue #11182 has been updated by Daniel Pittman.

Assignee deleted (Matt Robinson)


----------------------------------------
Feature #11182: List modules, classes and types available when one can't be 
found
https://projects.puppetlabs.com/issues/11182#change-59225

Author: Matt Robinson
Status: Accepted
Priority: Normal
Assignee: 
Category: error reporting
Target version: 2.7.x
Affected Puppet version: 
Keywords: module class type
Branch: https://github.com/mmrobins/puppet/tree/ticket/2.7.x/11182-list_modules


Right now if you install a module improperly, which is fairly easy to do, your 
puppet run will fail simply saying that the class or resource type you're 
trying to use couldn't be found.

    % puppet apply test.pp -v
    Could not find class wordpress for mattmac.puppetlabs.lan at 
/Users/matthewrobinson/work/puppet/test.pp:3 on node mattmac.puppetlabs.lan

It would be much more useful if we could list the modules, classes and/or types 
that were available.  This might be an overwhelming amount of info for large 
installations, so maybe do this only when at debug log level.

I briefly looked into this and it may be more than a trivial amount of work 
since the classes and types are lazy loaded, so known_resource_types won't have 
most of that info loaded when we're failing, and will never have info about 
classes or types that aren't used in your manifest:

    # lib/puppet/resource.rb:207
    if strict? and ! resource_type
      if @type == 'Class'
        raise ArgumentError, "Could not find declared class #{title}"
      else
        raise ArgumentError, "Invalid resource type #{type}"
      end
    end
 
While it would certainly be nice to have this info listed when you get the 
error, another compromise might be to add a face action (maybe on module) that 
lists the modules available and the classes and types they provide.  Then the 
error message could say to run that action `puppet module list` so that you 
could figure out why your manifest was failing.  I'm not sure that would be 
that much easier, but I imagine you wouldn't have to worry about being deep 
down in the resource.rb file when you need to handle listing all your modules.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to