mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Verify that we are passed a source script if a 'custom' source is provided
This commit is contained in:
@@ -1015,6 +1015,13 @@ class InventorySourceOptionsSerializer(BaseSerializer):
|
|||||||
# FIXME
|
# FIXME
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
def validate_source_script(self, attrs, source):
|
||||||
|
src = attrs.get(source, None)
|
||||||
|
if 'source' in attrs and attrs.get('source', '') == 'custom':
|
||||||
|
if src is None or src == '':
|
||||||
|
raise serializers.ValidationError("source_script must be provided")
|
||||||
|
return attrs
|
||||||
|
|
||||||
def validate_source_vars(self, attrs, source):
|
def validate_source_vars(self, attrs, source):
|
||||||
# source_env must be blank, a valid JSON or YAML dict, or ...
|
# source_env must be blank, a valid JSON or YAML dict, or ...
|
||||||
# FIXME: support key=value pairs.
|
# FIXME: support key=value pairs.
|
||||||
|
|||||||
Reference in New Issue
Block a user