summaryrefslogtreecommitdiffstats
path: root/hacking
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-10-12 02:44:42 +0200
committerGitHub <noreply@github.com>2023-10-12 02:44:42 +0200
commit40e4c697243ec571a82308b2680c16369ab6c412 (patch)
treebdb00315a976c5421191cd3c000836dc254d64b7 /hacking
parentUnit test cleanup (#81958) (diff)
downloadansible-40e4c697243ec571a82308b2680c16369ab6c412.tar.xz
ansible-40e4c697243ec571a82308b2680c16369ab6c412.zip
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.
Diffstat (limited to 'hacking')
-rwxr-xr-xhacking/ansible-profile.py (renamed from hacking/ansible-profile)12
l---------hacking/test-module1
2 files changed, 5 insertions, 8 deletions
diff --git a/hacking/ansible-profile b/hacking/ansible-profile.py
index 9856e7ab5c..7016ebe098 100755
--- a/hacking/ansible-profile
+++ b/hacking/ansible-profile.py
@@ -1,24 +1,22 @@
#!/usr/bin/env python
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
import cProfile
import sys
import traceback
-import ansible.constants as C
from ansible.module_utils.common.text.converters import to_text
target = sys.argv.pop(1)
myclass = "%sCLI" % target.capitalize()
+module_name = f'ansible.cli.{target}'
try:
# define cli
- mycli = getattr(__import__("ansible.cli.%s" % target, fromlist=[myclass]), myclass)
+ mycli = getattr(__import__(module_name, fromlist=[myclass]), myclass)
except ImportError as e:
- msg = getattr(e, 'msg', getattr(e, message, ''))
- if msg.endswith(' %s' % target):
- raise Exception("Ansible sub-program not implemented: %s" % target)
+ if module_name in e.msg:
+ raise Exception("Ansible sub-program not implemented: %s" % target) from None
else:
raise
diff --git a/hacking/test-module b/hacking/test-module
deleted file mode 120000
index 1deb52b467..0000000000
--- a/hacking/test-module
+++ /dev/null
@@ -1 +0,0 @@
-test-module.py \ No newline at end of file