Skip to content

Commit

Permalink
Cleanup the hacking directory a bit (ansible#81960)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
mattclay authored Oct 12, 2023
1 parent 9295bb5 commit 40e4c69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 5 additions & 7 deletions hacking/ansible-profile → hacking/ansible-profile.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion hacking/test-module

This file was deleted.

0 comments on commit 40e4c69

Please sign in to comment.