def getCurrentLicense(self): # Test current license... with request_context_safety(): context['translate'] = lambda x: x lic, sig = getSupportLicenseInfo() isSupportLicenseValid(lic_dict=lic, lic_sign=sig, raiseException=True) return lic, sig
def checkCurrentLicense(self): """ :return: 1 if license is available -1 if license is invalid 0 if license is not available """ try: # Test current license... getSupportLicenseInfo(validate=True, raiseException=True) return 1 except InvalidLicenseException as err: if err.type != 'UNLICENSED': # support license is invalid return -1 else: # support license not available return 0
def checkCurrentLicense(self): """ :return: 1 if license is available -1 if license is invalid 0 if license is not available """ try: # Test current license... with request_context_safety(): context['translate'] = lambda x: x getSupportLicenseInfo() return 1 except InvalidLicenseException as err: if err.type != 'UNLICENSED': # support license is invalid return -1 else: # support license not available return 0
def license(self): """ license return the support status, which is community support by default or the support subscription info, which could be the old license :return: json result with license info """ res = {} try: try: license_info, license_sig = getSupportLicenseInfo() except InvalidLicenseException as err: if err.type != 'UNLICENSED': raise err opt = {'valid': False, 'message': "%r" % err } return sendResult(response, {}, 1, opt=opt) # Add Extra info # if needed; use details = None ... for no details!)... license_ok, license_msg = verifyLicenseInfo(license_info, license_sig) if not license_ok: details = {'valid': license_ok, 'message': license_msg } else: details = {'valid': license_ok} res['token-num'] = int(license_info.get('token-num', 0)) # get all active tokens from all realms (including norealm) monit_handler = MonitorHandler() active_tokencount = monit_handler.get_active_tokencount() res['token-active'] = active_tokencount res['token-left'] = res['token-num'] - active_tokencount return sendResult(response, res, 1, opt=details) except Exception as exception: log.exception(exception) return sendError(response, exception) finally: Session.close() log.debug('[license] done')
def license(self): """ license return the support status, which is community support by default or the support subscription info, which could be the old license :return: json result with license info """ res = {} try: try: license_info, license_sig = getSupportLicenseInfo() except InvalidLicenseException as err: if err.type != 'UNLICENSED': raise err opt = {'valid': False, 'message': "%r" % err} return sendResult(response, {}, 1, opt=opt) # Add Extra info # if needed; use details = None ... for no details!)... license_ok, license_msg = verifyLicenseInfo( license_info, license_sig) if not license_ok: res = {'valid': license_ok, 'message': license_msg} else: details = {'valid': license_ok} res['token-num'] = int(license_info.get('token-num', 0)) # get all active tokens from all realms (including norealm) monit_handler = MonitorHandler() active_tokencount = monit_handler.get_active_tokencount() res['token-active'] = active_tokencount res['token-left'] = res['token-num'] - active_tokencount return sendResult(response, res, 1) except Exception as exception: log.exception(exception) return sendError(response, exception) finally: Session.close()
def getCurrentLicense(self): # Test current license... lic, sig = getSupportLicenseInfo() isSupportLicenseValid(lic_dict=lic, lic_sign=sig, raiseException=True) return (lic, sig)
def getCurrentLicense(self): # Test current license... lic, sig = getSupportLicenseInfo() isSupportLicenseValid(lic_dict=lic, lic_sign=sig, raiseException=True) return lic, sig