mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Merge pull request #11602 from ansible/avoid_project_updates_on_create_preload_data
Avoid Project..get_or_create() in create_preload_data
This commit is contained in:
@@ -25,13 +25,17 @@ class Command(BaseCommand):
|
|||||||
if not Organization.objects.exists():
|
if not Organization.objects.exists():
|
||||||
o, _ = Organization.objects.get_or_create(name='Default')
|
o, _ = Organization.objects.get_or_create(name='Default')
|
||||||
|
|
||||||
p, _ = Project.objects.get_or_create(
|
# Avoid calling directly the get_or_create() to bypass project update
|
||||||
name='Demo Project',
|
p = Project.objects.filter(name='Demo Project', scm_type='git').first()
|
||||||
scm_type='git',
|
if not p:
|
||||||
scm_url='https://github.com/ansible/ansible-tower-samples',
|
p = Project(
|
||||||
scm_update_on_launch=True,
|
name='Demo Project',
|
||||||
scm_update_cache_timeout=0,
|
scm_type='git',
|
||||||
)
|
scm_url='https://github.com/ansible/ansible-tower-samples',
|
||||||
|
scm_update_on_launch=True,
|
||||||
|
scm_update_cache_timeout=0,
|
||||||
|
)
|
||||||
|
|
||||||
p.organization = o
|
p.organization = o
|
||||||
p.save(skip_update=True)
|
p.save(skip_update=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user