mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 08:37:48 -02:30
Merge pull request #345 from jangsutsr/7532_disallow_custom_inv_src_from_using_wrong_cred
Disallow custom inventory sources from using meaningless credentials
This commit is contained in:
@@ -1143,6 +1143,11 @@ class InventorySourceOptions(BaseModel):
|
||||
# from the instance metadata instead of those explicitly provided.
|
||||
elif self.source in CLOUD_PROVIDERS and self.source != 'ec2':
|
||||
raise ValidationError(_('Credential is required for a cloud source.'))
|
||||
elif self.source == 'custom' and cred and cred.credential_type.kind in ('scm', 'ssh', 'insights', 'vault'):
|
||||
raise ValidationError(_(
|
||||
'Credentials of type machine, source control, insights and vault are '
|
||||
'disallowed for custom inventory sources.'
|
||||
))
|
||||
return cred
|
||||
|
||||
def clean_source_regions(self):
|
||||
|
||||
Reference in New Issue
Block a user