mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02:30
Don't auto-gen the demo project update on preload
This commit is contained in:
@@ -23,12 +23,13 @@ class Command(BaseCommand):
|
|||||||
superuser = None
|
superuser = None
|
||||||
with impersonate(superuser):
|
with impersonate(superuser):
|
||||||
o = Organization.objects.create(name='Default')
|
o = Organization.objects.create(name='Default')
|
||||||
p = Project.objects.create(name='Demo Project',
|
p = Project(name='Demo Project',
|
||||||
scm_type='git',
|
scm_type='git',
|
||||||
scm_url='https://github.com/ansible/ansible-tower-samples',
|
scm_url='https://github.com/ansible/ansible-tower-samples',
|
||||||
scm_update_on_launch=True,
|
scm_update_on_launch=True,
|
||||||
scm_update_cache_timeout=0,
|
scm_update_cache_timeout=0,
|
||||||
organization=o)
|
organization=o)
|
||||||
|
p.save(skip_update=True)
|
||||||
c = Credential.objects.create(name='Demo Credential',
|
c = Credential.objects.create(name='Demo Credential',
|
||||||
username=superuser.username,
|
username=superuser.username,
|
||||||
created_by=superuser)
|
created_by=superuser)
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ class Project(UnifiedJobTemplate, ProjectOptions, ResourceMixin):
|
|||||||
# If update_fields has been specified, add our field names to it,
|
# If update_fields has been specified, add our field names to it,
|
||||||
# if it hasn't been specified, then we're just doing a normal save.
|
# if it hasn't been specified, then we're just doing a normal save.
|
||||||
update_fields = kwargs.get('update_fields', [])
|
update_fields = kwargs.get('update_fields', [])
|
||||||
|
skip_update = bool(kwargs.pop('skip_update', False))
|
||||||
# Check if scm_type or scm_url changes.
|
# Check if scm_type or scm_url changes.
|
||||||
if self.pk:
|
if self.pk:
|
||||||
project_before = self.__class__.objects.get(pk=self.pk)
|
project_before = self.__class__.objects.get(pk=self.pk)
|
||||||
@@ -279,7 +280,7 @@ class Project(UnifiedJobTemplate, ProjectOptions, ResourceMixin):
|
|||||||
if update_fields:
|
if update_fields:
|
||||||
self.save(update_fields=update_fields)
|
self.save(update_fields=update_fields)
|
||||||
# If we just created a new project with SCM, start the initial update.
|
# If we just created a new project with SCM, start the initial update.
|
||||||
if new_instance and self.scm_type:
|
if new_instance and self.scm_type and not skip_update:
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def _get_current_status(self):
|
def _get_current_status(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user