ifnotreq.okand'Certificate still active.'inreq.text:
# raise a readable exception if the computer name is already used,
# instead of an opaque 500 Internal Error.
# this will not work with the new API.
ifexc.getcode()==500:
error_body=exc.read()
if'Certificate still active.'inerror_body:
logger.error('The node name "%s" is already in use. Please change the name, or revoke the active certificate if you want to replace the node.'%node_name)
sys.exit(1)
raise
logger.error('The node name "%s" is already in use. Please change the name, or revoke the active certificate if you want to replace the node.'%node_name)
sys.exit(1)
returnreq.read()
ifreq.status_code==403:
iftoken:
msg='Please check the authentication token or require a new one.'
else:
msg='Please check username and password.'
logger.error('Access denied to the SlapOS Master. %s',msg)