mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 14:11:24 -03:30
handle shutdown azure instances
This commit is contained in:
parent
c5d3089083
commit
48c194f2a9
@ -220,10 +220,15 @@ class AzureInventory(object):
|
||||
def add_deployment(self, cloud_service, deployment):
|
||||
"""Adds a deployment to the inventory and index"""
|
||||
for role in deployment.role_instance_list.role_instances:
|
||||
for ie in role.instance_endpoints.instance_endpoints:
|
||||
if ie.name == 'SSH':
|
||||
self.add_instance(role.instance_name, deployment, ie.public_port, cloud_service)
|
||||
break
|
||||
try:
|
||||
# Only consider ready vm instances (not StoppedDeallocated, not RoleStateUnknown, not StoppedVM)
|
||||
if role.instance_status == 'ReadyRole':
|
||||
for ie in role.instance_endpoints.instance_endpoints:
|
||||
if ie.name == 'SSH':
|
||||
self.add_instance(role.instance_name, deployment, ie.public_port, cloud_service)
|
||||
break
|
||||
except AttributeError:
|
||||
return
|
||||
|
||||
def add_instance(self, hostname, deployment, ssh_port, cloud_service):
|
||||
"""Adds an instance to the inventory and index"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user