SCM Inventory task system and variables stability edits

* Ensure "fresh bits" in dependent jobs
  - run IUs in same context and dependent PU
  - review docs for update-on-launch expectations
* Avoid customer variable precedence upgrade issues
  - only allow SCM types to have overwrite_vars=true
  - do not run other cloud sources through the backported script
* Make extra sure to echo stdout and stderr in event of error
This commit is contained in:
AlanCoding
2017-05-04 12:15:47 -04:00
parent 257dc459cf
commit 890b5bba58
5 changed files with 75 additions and 43 deletions

View File

@@ -1604,6 +1604,7 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt
update_on_launch = attrs.get('update_on_launch', self.instance and self.instance.update_on_launch)
update_on_project_update = get_field_from_model_or_attrs('update_on_project_update')
source = get_field_from_model_or_attrs('source')
overwrite_vars = get_field_from_model_or_attrs('overwrite_vars')
if attrs.get('source_path', None) and source!='scm':
raise serializers.ValidationError({"detail": _("Cannot set source_path if not SCM type.")})
@@ -1612,6 +1613,9 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt
elif not self.instance and attrs.get('inventory', None) and InventorySource.objects.filter(
inventory=attrs.get('inventory', None), update_on_project_update=True, source='scm').exists():
raise serializers.ValidationError({"detail": _("Inventory controlled by project-following SCM.")})
elif source=='scm' and not overwrite_vars:
raise serializers.ValidationError({"detail": _(
"SCM type sources must set `overwrite_vars` to `true` until a future Tower release.")})
return super(InventorySourceSerializer, self).validate(attrs)