include license data/state in the sosreport

This commit is contained in:
Ryan Petrello 2019-09-03 13:42:26 -04:00
parent f21c6dc330
commit 7a8234bb09
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,8 @@
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved
import json
from awx.main.utils import get_licenser
from django.core.management.base import BaseCommand
@ -8,6 +10,15 @@ from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""Returns license type, e.g., 'enterprise', 'open', 'none'"""
def add_arguments(self, parser):
parser.add_argument('--data', dest='data', action='store_true',
help='verbose, prints the actual (sanitized) license')
def handle(self, *args, **options):
super(Command, self).__init__()
return get_licenser().validate().get('license_type', 'none')
license = get_licenser().validate()
if options.get('data'):
if license.get('license_key', '') != 'UNLICENSED':
license['license_key'] = '********'
return json.dumps(license)
return license.get('license_type', 'none')

View File

@ -7,6 +7,7 @@ SOSREPORT_TOWER_COMMANDS = [
"awx-manage --version", # tower version
"awx-manage list_instances", # tower cluster configuration
"awx-manage run_dispatcher --status", # tower dispatch worker status
"awx-manage check_license --data", # tower license status
"supervisorctl status", # tower process status
"/var/lib/awx/venv/awx/bin/pip freeze", # pip package list
"/var/lib/awx/venv/awx/bin/pip freeze -l", # pip package list without globally-installed packages