forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Matt Clay <[email protected]> Co-authored-by: Matt Davis <[email protected]> Co-authored-by: Sviatoslav Sydorenko <[email protected]>
- Loading branch information
1 parent
43d0971
commit 66a8331
Showing
51 changed files
with
538 additions
and
642 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../lib/ansible/cli/scripts/ansible_cli_stub.py | ||
../lib/ansible/cli/adhoc.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/config.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/console.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/doc.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/galaxy.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/inventory.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/playbook.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/pull.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ansible | ||
../lib/ansible/cli/vault.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
minor_changes: | ||
- Installation - modernize our python installation, to reduce dynamic code in setup.py, and migrate | ||
what is feasible to setup.cfg. This will enable shipping wheels in the future. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright: (c) 2021, Matt Martz <[email protected]> | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
import argparse | ||
import importlib | ||
import os | ||
import sys | ||
|
||
from importlib.metadata import distribution | ||
|
||
|
||
def _short_name(name): | ||
return name.replace('ansible-', '').replace('ansible', 'adhoc') | ||
|
||
|
||
def main(): | ||
dist = distribution('ansible-core') | ||
ep_map = {_short_name(ep.name): ep for ep in dist.entry_points if ep.group == 'console_scripts'} | ||
|
||
parser = argparse.ArgumentParser(prog='python -m ansible', add_help=False) | ||
parser.add_argument('entry_point', choices=list(ep_map) + ['test']) | ||
args, extra = parser.parse_known_args() | ||
|
||
if args.entry_point == 'test': | ||
ansible_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
source_root = os.path.join(ansible_root, 'test', 'lib') | ||
|
||
if os.path.exists(os.path.join(source_root, 'ansible_test', '_internal', '__init__.py')): | ||
# running from source, use that version of ansible-test instead of any version that may already be installed | ||
sys.path.insert(0, source_root) | ||
|
||
module = importlib.import_module('ansible_test._util.target.cli.ansible_test_cli_stub') | ||
main = module.main | ||
else: | ||
main = ep_map[args.entry_point].load() | ||
|
||
main([args.entry_point] + extra) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env python | ||
# Copyright: (c) 2012, Michael DeHaan <[email protected]> | ||
# Copyright: (c) 2018, Ansible Project | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
# PYTHON_ARGCOMPLETE_OK | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
# ansible.cli needs to be imported first, to ensure the source bin/* scripts run that code first | ||
from ansible.cli import CLI | ||
from ansible import constants as C | ||
from ansible import context | ||
from ansible.cli import CLI | ||
from ansible.cli.arguments import option_helpers as opt_help | ||
from ansible.errors import AnsibleError, AnsibleOptionsError | ||
from ansible.executor.task_queue_manager import TaskQueueManager | ||
|
@@ -25,6 +28,8 @@ class AdHocCLI(CLI): | |
this command allows you to define and run a single task 'playbook' against a set of hosts | ||
''' | ||
|
||
name = 'ansible' | ||
|
||
def init_parser(self): | ||
''' create an options parser for bin/ansible ''' | ||
super(AdHocCLI, self).init_parser(usage='%prog <host-pattern> [options]', | ||
|
@@ -179,3 +184,11 @@ def run(self): | |
loader.cleanup_all_tmp_files() | ||
|
||
return result | ||
|
||
|
||
def main(args=None): | ||
AdHocCLI.cli_executor(args) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.