mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 20:05:03 -02:30
prefer port with name SSH but don't require it
This commit is contained in:
@@ -221,13 +221,15 @@ class AzureInventory(object):
|
|||||||
"""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:
|
||||||
try:
|
try:
|
||||||
# Only consider ready vm instances (not StoppedDeallocated, not RoleStateUnknown, not StoppedVM)
|
# Default port 22 unless port found with name 'SSH'
|
||||||
if role.instance_status == 'ReadyRole':
|
port = '22'
|
||||||
for ie in role.instance_endpoints.instance_endpoints:
|
for ie in role.instance_endpoints.instance_endpoints:
|
||||||
if ie.name == 'SSH':
|
if ie.name == 'SSH':
|
||||||
self.add_instance(role.instance_name, deployment, ie.public_port, cloud_service)
|
port = ie.public_port
|
||||||
break
|
break
|
||||||
except AttributeError:
|
self.add_instance(role.instance_name, deployment, port, cloud_service)
|
||||||
|
except AttributeError as e:
|
||||||
|
print json.dumps({ 'msg': 'Attribute error %s' % e })
|
||||||
return
|
return
|
||||||
|
|
||||||
def add_instance(self, hostname, deployment, ssh_port, cloud_service):
|
def add_instance(self, hostname, deployment, ssh_port, cloud_service):
|
||||||
|
|||||||
Reference in New Issue
Block a user