diff --git a/CHANGES/+no-arch-all-validation.removal b/CHANGES/+no-arch-all-validation.removal new file mode 100644 index 000000000..b0c5b9b76 --- /dev/null +++ b/CHANGES/+no-arch-all-validation.removal @@ -0,0 +1,2 @@ +Added validation that prevents users from creating ReleaseArchitecture content for the special value "Architecture: all". +If you have previously created the content unit you can keep using it. diff --git a/pulp_deb/app/serializers/content_serializers.py b/pulp_deb/app/serializers/content_serializers.py index 3a8b763fc..656d038c1 100644 --- a/pulp_deb/app/serializers/content_serializers.py +++ b/pulp_deb/app/serializers/content_serializers.py @@ -913,6 +913,16 @@ class ReleaseArchitectureSerializer(NoArtifactContentSerializer): help_text="Architecture variant name, if this architecture is a variant.", ) + def validate(self, data): + """ + Ensure we do not create a ReleaseArchitecture object for special value 'all'. + """ + data = super().validate(data) + if data.get("architecture") == "all": + message = "This field does not accept the special value 'all'!" + raise ValidationError({"architecture": _(message)}) + return data + def get_unique_together_validators(self): """ We do not want UniqueTogetherValidator since we have retrieve logic!