mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
Final round of moving modules to new import error msg (#51852)
* Final round of moving modules to new import error msg * readd URL to jenkins install guide * fix unit tests
This commit is contained in:
committed by
AlanCoding
parent
71c625bd83
commit
ca782a495d
@@ -27,7 +27,9 @@
|
|||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
TOWER_CLI_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
import tower_cli.utils.exceptions as exc
|
import tower_cli.utils.exceptions as exc
|
||||||
from tower_cli.utils import parser
|
from tower_cli.utils import parser
|
||||||
@@ -35,9 +37,10 @@ try:
|
|||||||
|
|
||||||
HAS_TOWER_CLI = True
|
HAS_TOWER_CLI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
TOWER_CLI_IMP_ERR = traceback.format_exc()
|
||||||
HAS_TOWER_CLI = False
|
HAS_TOWER_CLI = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
|
|
||||||
|
|
||||||
def tower_auth_config(module):
|
def tower_auth_config(module):
|
||||||
@@ -105,4 +108,5 @@ class TowerModule(AnsibleModule):
|
|||||||
super(TowerModule, self).__init__(argument_spec=args, **kwargs)
|
super(TowerModule, self).__init__(argument_spec=args, **kwargs)
|
||||||
|
|
||||||
if not HAS_TOWER_CLI:
|
if not HAS_TOWER_CLI:
|
||||||
self.fail_json(msg='ansible-tower-cli required for this module')
|
self.fail_json(msg=missing_required_lib('ansible-tower-cli'),
|
||||||
|
exception=TOWER_CLI_IMP_ERR)
|
||||||
|
|||||||
Reference in New Issue
Block a user