mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Use common functions for handling import errors (#51851)
* Use common functions for handling import errors * use refactored version of gitlab modules
This commit is contained in:
parent
28dcfa985f
commit
c1e51ef486
39 changed files with 233 additions and 93 deletions
|
@ -27,11 +27,16 @@
|
|||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
|
||||
UCSMSDK_IMP_ERR = None
|
||||
try:
|
||||
import ucsmsdk
|
||||
HAS_UCSMSDK = True
|
||||
except Exception:
|
||||
UCSMSDK_IMP_ERR = traceback.format_exc()
|
||||
HAS_UCSMSDK = False
|
||||
|
||||
ucs_argument_spec = dict(
|
||||
|
@ -51,7 +56,7 @@ class UCSModule():
|
|||
self.module = module
|
||||
self.result = {}
|
||||
if not HAS_UCSMSDK:
|
||||
self.module.fail_json(msg='ucsmsdk is required for this module')
|
||||
self.module.fail_json(msg=missing_required_lib('ucsmsdk'), exception=UCSMSDK_IMP_ERR)
|
||||
self.login()
|
||||
|
||||
def __del__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue