mirror of
https://github.com/ansible/awx.git
synced 2026-04-09 12:09:20 -02:30
Merge pull request #9219 from mazhead/devel
Adding the scm_track_submodules option for project SUMMARY Adding the scm_track_submodules option which should fix the related #7846 ISSUE TYPE Feature Pull Request COMPONENT NAME API UI AWX VERSION awx: 17.0.1 ADDITIONAL INFORMATION This option will add the track_submodules option which is described in the ansible git module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html if yes, submodules will track the latest commit on their master branch (or other branch specified in .gitmodules). If no, submodules will be kept at the revision specified by the main project. This is equivalent to specifying the --remote flag to git submodule update. Reviewed-by: Shane McDonald <me@shanemcd.com> Reviewed-by: Alan Rominger <arominge@redhat.com> Reviewed-by: None <None> Reviewed-by: Alex Corey <Alex.swansboro@gmail.com>
This commit is contained in:
@@ -1350,6 +1350,7 @@ class ProjectOptionsSerializer(BaseSerializer):
|
||||
'scm_branch',
|
||||
'scm_refspec',
|
||||
'scm_clean',
|
||||
'scm_track_submodules',
|
||||
'scm_delete_on_update',
|
||||
'credential',
|
||||
'timeout',
|
||||
@@ -1384,6 +1385,8 @@ class ProjectOptionsSerializer(BaseSerializer):
|
||||
errors['scm_branch'] = _('SCM branch cannot be used with archive projects.')
|
||||
if attrs.get('scm_refspec') and scm_type != 'git':
|
||||
errors['scm_refspec'] = _('SCM refspec can only be used with git projects.')
|
||||
if attrs.get('scm_track_submodules') and scm_type != 'git':
|
||||
errors['scm_track_submodules'] = _('SCM track_submodules can only be used with git projects.')
|
||||
|
||||
if errors:
|
||||
raise serializers.ValidationError(errors)
|
||||
@@ -1510,7 +1513,7 @@ class ProjectSerializer(UnifiedJobTemplateSerializer, ProjectOptionsSerializer):
|
||||
)
|
||||
|
||||
if get_field_from_model_or_attrs('scm_type') == '':
|
||||
for fd in ('scm_update_on_launch', 'scm_delete_on_update', 'scm_clean'):
|
||||
for fd in ('scm_update_on_launch', 'scm_delete_on_update', 'scm_track_submodules', 'scm_clean'):
|
||||
if get_field_from_model_or_attrs(fd):
|
||||
raise serializers.ValidationError({fd: _('Update options must be set to false for manual projects.')})
|
||||
return super(ProjectSerializer, self).validate(attrs)
|
||||
|
||||
Reference in New Issue
Block a user