Skip to content

Commit

Permalink
Merge pull request #1754 from caberos/issue1749
Browse files Browse the repository at this point in the history
Unhandled error running a subcommand in slcli
  • Loading branch information
allmightyspiff committed Sep 23, 2022
2 parents 425046d + f88c7cd commit 1bd004d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions SoftLayer/CLI/object_storage/credential/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ def get_command(self, ctx, cmd_name):
"""Get command for click."""
path = "%s.%s" % (__name__, cmd_name)
path = path.replace("-", "_")
module = importlib.import_module(path)
return getattr(module, 'cli')
try:
module = importlib.import_module(path)
return getattr(module, 'cli')
except ModuleNotFoundError as ex:
print(ex.name)
return None


# Required to get the sub-sub-sub command to work.
Expand Down
8 changes: 6 additions & 2 deletions SoftLayer/CLI/virt/capacity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def get_command(self, ctx, cmd_name):
"""Get command for click."""
path = "%s.%s" % (__name__, cmd_name)
path = path.replace("-", "_")
module = importlib.import_module(path)
return getattr(module, 'cli')
try:
module = importlib.import_module(path)
return getattr(module, 'cli')
except ModuleNotFoundError as ex:
print(ex.name)
return None


# Required to get the sub-sub-sub command to work.
Expand Down
8 changes: 6 additions & 2 deletions SoftLayer/CLI/virt/placementgroup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ def get_command(self, ctx, cmd_name):
"""Get command for click."""
path = "%s.%s" % (__name__, cmd_name)
path = path.replace("-", "_")
module = importlib.import_module(path)
return getattr(module, 'cli')
try:
module = importlib.import_module(path)
return getattr(module, 'cli')
except ModuleNotFoundError as ex:
print(ex.name)
return None


# Required to get the sub-sub-sub command to work.
Expand Down

0 comments on commit 1bd004d

Please sign in to comment.