mirror of https://github.com/ansible/ansible.git
Cleanup the hacking directory a bit (#81960)
* Clean up hacking/ansible-profile script Also rename the script so it has a `.py` extension. * Remove test-module symlink Use the test-module.py script instead.pull/81961/head
parent
9295bb5b5d
commit
40e4c69724
@ -1,24 +1,22 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import annotations
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import cProfile
|
import cProfile
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import ansible.constants as C
|
|
||||||
from ansible.module_utils.common.text.converters import to_text
|
from ansible.module_utils.common.text.converters import to_text
|
||||||
|
|
||||||
target = sys.argv.pop(1)
|
target = sys.argv.pop(1)
|
||||||
myclass = "%sCLI" % target.capitalize()
|
myclass = "%sCLI" % target.capitalize()
|
||||||
|
module_name = f'ansible.cli.{target}'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# define cli
|
# define cli
|
||||||
mycli = getattr(__import__("ansible.cli.%s" % target, fromlist=[myclass]), myclass)
|
mycli = getattr(__import__(module_name, fromlist=[myclass]), myclass)
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
msg = getattr(e, 'msg', getattr(e, message, ''))
|
if module_name in e.msg:
|
||||||
if msg.endswith(' %s' % target):
|
raise Exception("Ansible sub-program not implemented: %s" % target) from None
|
||||||
raise Exception("Ansible sub-program not implemented: %s" % target)
|
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
test-module.py
|
|
Loading…
Reference in New Issue