restructure so the -q is actually completely quiet

This commit is contained in:
Rebeccah 2021-06-03 15:46:04 -04:00
parent 550ab82f63
commit bd2da80cea
No known key found for this signature in database
GPG Key ID: 40B19D22F2604B29
3 changed files with 13 additions and 9 deletions

View File

@ -37,12 +37,10 @@ class Command(BaseCommand):
results["job_templates"] = jts
results["projects"] = proj
results["inventory_sources"] = invsrc
print('\n', '# {}'.format("Virtual environments associations:"))
print(yaml.dump(results))
if not options.get('q'):
msg = [
'',
'# Virtual Environments Associations:',
yaml.dump(results),
'- To list all (now deprecated) custom virtual environments run:',
'awx-manage list_custom_venvs',
'',
@ -53,6 +51,8 @@ class Command(BaseCommand):
'',
]
print('\n'.join(msg))
else:
print(yaml.dump(results))
else:
print('\n', '# Incorrect path, verify your path is from the following list:')

View File

@ -26,10 +26,10 @@ class Command(BaseCommand):
if path[0] in all_venvs:
pip_data = get_custom_venv_pip_freeze(options.get('path')[0])
if pip_data:
print('\n', '# {}'.format("Virtual environment contents:"))
print(pip_data)
if not options.get('q'):
msg = [
'# Virtual environment contents:',
pip_data,
'- To list all (now deprecated) custom virtual environments run:',
'awx-manage list_custom_venvs',
'',
@ -40,6 +40,8 @@ class Command(BaseCommand):
'',
]
print('\n'.join(msg))
else:
print(pip_data)
else:
print('\n', '# Incorrect path, verify your path is from the following list:')

View File

@ -17,10 +17,11 @@ class Command(BaseCommand):
super(Command, self).__init__()
venvs = get_custom_venv_choices()
if venvs:
print('\n', '# {}'.format("Discovered virtual environments:"))
print('\n'.join(venvs), '\n')
if not options.get('q'):
msg = [
'# Discovered Virtual Environments:',
'\n'.join(venvs),
'',
'- To export the contents of a (deprecated) virtual environment, ' 'run the following command while supplying the path as an argument:',
'awx-manage export_custom_venv /path/to/venv',
'',
@ -31,7 +32,8 @@ class Command(BaseCommand):
'',
]
print('\n'.join(msg))
else:
print('\n'.join(venvs), '\n')
else:
msg = ["No custom virtual environments detected in:", settings.BASE_VENV_PATH]