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.
This commit is contained in:
Matt Clay 2023-10-11 17:44:42 -07:00 committed by GitHub
parent 9295bb5b5d
commit 40e4c69724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -1 +0,0 @@
test-module.py