Skip to content

Commit

Permalink
AZ should ignore corrupted modules instead of crashing Azure#293 (Az…
Browse files Browse the repository at this point in the history
  • Loading branch information
derekbekoe authored and johanste committed May 25, 2016
1 parent e1b6120 commit c86060b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/azure/cli/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import time
import random
import traceback
from importlib import import_module
from collections import defaultdict, OrderedDict
from pip import get_installed_distributions
Expand Down Expand Up @@ -140,12 +141,20 @@ def get_command_table(module_name=None):
except ImportError:
# Unknown command - we'll load all installed modules below
logger.info("Loading all installed modules as module with name '%s' not found.", module_name) #pylint: disable=line-too-long
except Exception: #pylint: disable=broad-except
# Catch exception whilst loading the command module.
# We don't log anything here as we will log below when we try and load all.
pass

if not loaded:
command_table = {}
logger.info('Loading command tables from all installed modules.')
for mod in INSTALLED_COMMAND_MODULES:
command_table.update(_get_command_table(mod))
try:
command_table.update(_get_command_table(mod))
except Exception: #pylint: disable=broad-except
logger.error("Error loading command module '%s'", mod)
logger.debug(traceback.format_exc())

ordered_commands = OrderedDict(command_table)
return ordered_commands

0 comments on commit c86060b

Please sign in to comment.