add an awx-manage command that gets pip freeze data from custom_venvs and outputs to command line stdout

remove analytics tests for counts of custom venvs, bump collector version, and remove list of custom venvs from API
This commit is contained in:
Rebeccah
2021-04-22 13:45:33 -04:00
parent c34fa30ea7
commit dfaa69be51
7 changed files with 48 additions and 28 deletions

View File

@@ -0,0 +1,28 @@
# Copyright (c) 2021 Ansible, Inc.
# All Rights Reserved
from awx.main.utils.common import get_custom_venv_choices, get_custom_venv_pip_freeze
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""Returns either a list of custom venv paths or outputs the pip freeze from the path passed in the argument"""
def add_arguments(self, parser):
parser.add_argument(
'--path',
dest='path',
type=str,
default='',
help='run without arguments to see a list of paths, run with one of those paths as an argument and see the pip freeze data',
)
def handle(self, *args, **options):
super(Command, self).__init__()
if options.get('path'):
pip_data = get_custom_venv_pip_freeze(options.get('path'))
print(pip_data)
else:
venvs = get_custom_venv_choices()
for venv in venvs:
print(venv)