Files
awx/awx/main/management/commands/list_instances.py
2016-11-15 20:59:39 -05:00

17 lines
483 B
Python

# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved
from awx.main.models import Instance
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
"""List instances from the Tower database
"""
def handle(self, **options):
super(Command, self).__init__()
for instance in Instance.objects.all():
print("hostname: {}; created: {}; heartbeat: {}".format(instance.hostname, instance.created, instance.modified))