puppetlabs/puppet — pull request #899 by jeffmccune (2012-06-29 22:29:38+00:00)
Title: (#15307) Fix puppet help when a face throws an exception

Without this patch applied the `puppet help` command displays nothing but an
exception when a 3rd party face throws an exception during the loading
process.

For example:

Error: Could not autoload puppet/face/node/classify: no such file to load
-- fog
Error: Could not autoload puppet/face/node: Could not autoload
puppet/face/node/classify: no such file to load -- fog
Error: Failed to load face node:
Error: Could not find version current of node
Error: Try 'puppet help help help' for usage

This is a problem because `puppet help` should be robust and provide helpful
information in all cases.

This patch fixes the problem by catching loading errors when building the
list of available face subcommands and their summaries. If an exception is
caught, it is handled by marking that face subcommand and presenting a
message indicating the face is unavailable in the help output.

This looks like:

Usage: puppet [options] [options]

Available subcommands:

agent The puppet agent daemon
apply Apply Puppet manifests locally
ca Local Puppet Certificate Authority management.
catalog Compile, save, view, and convert catalogs.
cert Manage certificates and requests
certificate Provide access to the CA for certificate management.
certificate_request Manage certificate requests.
certificate_revocation_list Manage the list of revoked certificates.
config Interact with Puppet's configuration options.
describe Display help about resource types
device Manage remote network devices
doc Generate Puppet documentation and references
facts Retrieve and store facts.
file Retrieve and store files in a filebucket
filebucket Store and retrieve files in a filebucket
help Display Puppet help.
inspect Send an inspection report
instrumentation_data Manage instrumentation listener accumulated data.
instrumentation_listener Manage instrumentation listeners.
instrumentation_probe Manage instrumentation probes.
key Create, save, and remove certificate keys.
kick Remotely control puppet agent
man Display Puppet manual pages.
master The puppet master daemon
module Creates, installs and searches for modules on the
Puppet Forge.
! node ! Subcommand unavailable due to error. Check error
logs.
! node_aws ! Subcommand unavailable due to error. Check error
logs.
! node_vmware ! Subcommand unavailable due to error. Check error
logs.
parser Interact directly with the parser.
plugin Interact with the Puppet plugin system.
queue Queuing daemon for asynchronous storeconfigs
report Create, display, and submit reports.
resource The resource abstraction layer shell
resource_type View classes, defined resource types, and nodes from
all manifests.
secret_agent Mimics puppet agent.
status View puppet server status.

See 'puppet help ' for help on a specific subcommand
action.
See 'puppet help ' for help on a specific subcommand.
Puppet v3.0.0