mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
handle shutdown azure instances
This commit is contained in:
@@ -220,10 +220,15 @@ class AzureInventory(object):
|
|||||||
def add_deployment(self, cloud_service, deployment):
|
def add_deployment(self, cloud_service, deployment):
|
||||||
"""Adds a deployment to the inventory and index"""
|
"""Adds a deployment to the inventory and index"""
|
||||||
for role in deployment.role_instance_list.role_instances:
|
for role in deployment.role_instance_list.role_instances:
|
||||||
for ie in role.instance_endpoints.instance_endpoints:
|
try:
|
||||||
if ie.name == 'SSH':
|
# Only consider ready vm instances (not StoppedDeallocated, not RoleStateUnknown, not StoppedVM)
|
||||||
self.add_instance(role.instance_name, deployment, ie.public_port, cloud_service)
|
if role.instance_status == 'ReadyRole':
|
||||||
break
|
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):
|
def add_instance(self, hostname, deployment, ssh_port, cloud_service):
|
||||||
"""Adds an instance to the inventory and index"""
|
"""Adds an instance to the inventory and index"""
|
||||||
|
|||||||
Reference in New Issue
Block a user