|
10 | 10 | from cloudshell.cp.vcenter.exceptions.task_waiter import TaskFaultException |
11 | 11 |
|
12 | 12 |
|
13 | | - |
14 | | -class VCenterAuthError (Exception): |
15 | | - def __init__(self, original_exception): |
16 | | - super(VCenterAuthError, self).__init__(original_exception.message) |
| 13 | +class VCenterAuthError(Exception): |
| 14 | + def __init__(self, message, original_exception): |
| 15 | + """ |
| 16 | + :param str message: |
| 17 | + :param original_exception: The orginoal exception that was raised |
| 18 | + :return: |
| 19 | + """ |
| 20 | + super(VCenterAuthError, self).__init__(message) |
17 | 21 | self.original_exception = original_exception |
18 | 22 |
|
19 | 23 |
|
@@ -72,7 +76,7 @@ def connect(self, address, user, password, port=443): |
72 | 76 | si = self.pyvmomi_connect(host=address, user=user, pwd=password, port=port) |
73 | 77 | return si |
74 | 78 | except vim.fault.InvalidLogin as e: |
75 | | - raise VCenterAuthError(e.msg) |
| 79 | + raise VCenterAuthError(e.msg, e) |
76 | 80 | except IOError as e: |
77 | 81 | # logger.info("I/O error({0}): {1}".format(e.errno, e.strerror)) |
78 | 82 | raise ValueError('Cannot connect to vCenter, please check that the address is valid') |
@@ -314,7 +318,7 @@ def get_obj(self, content, vimtype, name): |
314 | 318 | @staticmethod |
315 | 319 | def _get_all_objects_by_type(content, vimtype): |
316 | 320 | container = content.viewManager.CreateContainerView( |
317 | | - content.rootFolder, vimtype, True) |
| 321 | + content.rootFolder, vimtype, True) |
318 | 322 | return container |
319 | 323 |
|
320 | 324 | @staticmethod |
|
0 commit comments