Add an HA list_instances management command

This commit is contained in:
Matthew Jones
2015-01-08 15:03:53 -05:00
parent 0eaf2dc00c
commit 2db98a9461

View File

@@ -0,0 +1,19 @@
# Copyright (c) 2014 Ansible, Inc.
# All Rights Reserved
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from awx.main.models import Instance
class Command(BaseCommand):
"""List instances from the Tower database
"""
def handle(self, **options):
for instance in Instance.objects.all():
print("uuid: %s; hostname: %s; primary: %s; created: %s; modified: %s" %
(instance.uuid, instance.hostname, instance.primary, instance.created, instance.modified))