in ad-joining/register-computer/ad/domain.py [0:0]
def set_computer_upn(self, ou, computer_name, upn):
try:
self.__connection.modify(
"CN=%s,%s" % (computer_name, ou),
{
"userPrincipalName": [(ldap3.MODIFY_REPLACE, [upn])]
})
except ldap3.core.exceptions.LDAPAttributeOrValueExistsResult as e:
raise AlreadyExistsException(e)