(self)
return credential
Return the credential which is directly tied to the inventory source type.
Return the credential which is directly tied to the inventory source type.
Return the credential which is directly tied to the inventory source type .
def get_cloud_credential(self):
        """Return the credential which is directly tied to the inventory source type."""
        credential = None
        for cred in self.credentials.all():
            if self.source in CLOUD_PROVIDERS:
                if cred.kind == self.source.replace('ec2', 'aws'):
                    credential = cred
                    break
            else:
                # these need to be returned in the API credential field
                if cred.credential_type.kind != 'vault':
                    credential = cred
                    break
        return credential
def get_cloud_credential ( self ) : credential = None for cred in self . credentials . all ( ) : if self . source in CLOUD_PROVIDERS : if cred . kind == self . source . replace ( 'ec2' , 'aws' ) : credential = cred break else : # these need to be returned in the API credential field if cred . credential_type . kind != 'vault' : credential = cred break return credential