disallow insights creds on smart inventory

related to #7083
This commit is contained in:
Chris Meyers
2017-07-19 16:43:19 -04:00
parent 4b168f5f1c
commit c2204e5f27
2 changed files with 39 additions and 0 deletions

View File

@@ -370,6 +370,8 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin):
return self.groups.exclude(parents__pk__in=group_pks).distinct()
def clean_insights_credential(self):
if self.kind == 'smart':
raise ValidationError(_("Assignment not allowed for Smart Inventory"))
if self.insights_credential and self.insights_credential.credential_type.kind != 'insights':
raise ValidationError(_("Credential kind must be 'insights'."))
return self.insights_credential