mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Merge pull request #1439 from ryanpetrello/fix-7923
add validation to InventorySource.inventory to avoid task manager death
This commit is contained in:
commit
1596b2907b
@ -1653,6 +1653,8 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions, JobNotificationMixin,
|
|||||||
organization_groups = []
|
organization_groups = []
|
||||||
if self.inventory_source.inventory is not None:
|
if self.inventory_source.inventory is not None:
|
||||||
inventory_groups = [x for x in self.inventory_source.inventory.instance_groups.all()]
|
inventory_groups = [x for x in self.inventory_source.inventory.instance_groups.all()]
|
||||||
|
else:
|
||||||
|
inventory_groups = []
|
||||||
selected_groups = inventory_groups + organization_groups
|
selected_groups = inventory_groups + organization_groups
|
||||||
if not selected_groups:
|
if not selected_groups:
|
||||||
return self.global_instance_groups
|
return self.global_instance_groups
|
||||||
|
@ -1998,6 +1998,9 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
inventory_source = inventory_update.inventory_source
|
inventory_source = inventory_update.inventory_source
|
||||||
inventory = inventory_source.inventory
|
inventory = inventory_source.inventory
|
||||||
|
|
||||||
|
if inventory is None:
|
||||||
|
raise RuntimeError('Inventory Source is not associated with an Inventory.')
|
||||||
|
|
||||||
# Piece together the initial command to run via. the shell.
|
# Piece together the initial command to run via. the shell.
|
||||||
args = ['awx-manage', 'inventory_import']
|
args = ['awx-manage', 'inventory_import']
|
||||||
args.extend(['--inventory-id', str(inventory.pk)])
|
args.extend(['--inventory-id', str(inventory.pk)])
|
||||||
|
Loading…
Reference in New Issue
Block a user