mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Merge pull request #27 from AlanCoding/initial_sync
Use "sync" type when doing SCM inv src update on create
This commit is contained in:
@@ -1311,7 +1311,7 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions):
|
|||||||
# Schedule a new Project update if one is not already queued
|
# Schedule a new Project update if one is not already queued
|
||||||
if self.source_project and not self.source_project.project_updates.filter(
|
if self.source_project and not self.source_project.project_updates.filter(
|
||||||
status__in=['new', 'pending', 'waiting']).exists():
|
status__in=['new', 'pending', 'waiting']).exists():
|
||||||
self.source_project.update()
|
self.update()
|
||||||
if not getattr(_inventory_updates, 'is_updating', False):
|
if not getattr(_inventory_updates, 'is_updating', False):
|
||||||
if self.inventory is not None:
|
if self.inventory is not None:
|
||||||
self.inventory.update_computed_fields(update_groups=False, update_hosts=False)
|
self.inventory.update_computed_fields(update_groups=False, update_hosts=False)
|
||||||
|
|||||||
@@ -1422,7 +1422,7 @@ class RunProjectUpdate(BaseTask):
|
|||||||
if InventoryUpdate.objects.filter(inventory_source=inv_src,
|
if InventoryUpdate.objects.filter(inventory_source=inv_src,
|
||||||
status__in=ACTIVE_STATES).exists():
|
status__in=ACTIVE_STATES).exists():
|
||||||
logger.info('Skipping SCM inventory update for `{}` because '
|
logger.info('Skipping SCM inventory update for `{}` because '
|
||||||
'another update is already active.'.format(inv.name))
|
'another update is already active.'.format(inv_src.name))
|
||||||
continue
|
continue
|
||||||
local_inv_update = inv_src.create_inventory_update(
|
local_inv_update = inv_src.create_inventory_update(
|
||||||
launch_type='scm',
|
launch_type='scm',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from awx.main.models import InventorySource
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def scm_inventory(inventory, project):
|
def scm_inventory(inventory, project):
|
||||||
with mock.patch.object(project, 'update'):
|
with mock.patch('awx.main.models.unified_jobs.UnifiedJobTemplate.update'):
|
||||||
inventory.inventory_sources.create(
|
inventory.inventory_sources.create(
|
||||||
name='foobar', update_on_project_update=True, source='scm',
|
name='foobar', update_on_project_update=True, source='scm',
|
||||||
source_project=project, scm_last_revision=project.scm_revision)
|
source_project=project, scm_last_revision=project.scm_revision)
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ def scm_inventory_source(inventory, project):
|
|||||||
update_on_project_update=True,
|
update_on_project_update=True,
|
||||||
inventory=inventory,
|
inventory=inventory,
|
||||||
scm_last_revision=project.scm_revision)
|
scm_last_revision=project.scm_revision)
|
||||||
with mock.patch.object(inv_src.source_project, 'update'):
|
with mock.patch('awx.main.models.unified_jobs.UnifiedJobTemplate.update'):
|
||||||
inv_src.save()
|
inv_src.save()
|
||||||
return inv_src
|
return inv_src
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user