def page(self): if not user.may("wato.automation"): raise MKAuthException(_("This account has no permission for automation.")) response.set_content_type("text/plain") _set_version_headers() # Parameter was added with 1.5.0p10 if not request.has_var("_version"): raise MKGeneralException(_("Your central site is incompatible with this remote site")) # - _version and _edition_short were added with 1.5.0p10 to the login call only # - x-checkmk-version and x-checkmk-edition were added with 2.0.0p1 # Prefer the headers and fall back to the request variables for now. central_version = ( request.headers["x-checkmk-version"] if "x-checkmk-version" in request.headers else request.get_ascii_input_mandatory("_version") ) central_edition_short = ( request.headers["x-checkmk-edition"] if "x-checkmk-edition" in request.headers else request.get_ascii_input_mandatory("_edition_short") ) if not compatible_with_central_site( central_version, central_edition_short, cmk_version.__version__, cmk_version.edition_short(), ): raise MKGeneralException( _( "Your central site (Version: %s, Edition: %s) is incompatible with this " "remote site (Version: %s, Edition: %s)" ) % ( central_version, central_edition_short, cmk_version.__version__, cmk_version.edition_short(), ) ) response.set_data( repr( { "version": cmk_version.__version__, "edition_short": cmk_version.edition_short(), "login_secret": _get_login_secret(create_on_demand=True), } ) )
def _verify_compatibility(self) -> None: central_version = request.headers.get("x-checkmk-version", "") central_edition_short = request.headers.get("x-checkmk-edition", "") if not compatible_with_central_site( central_version, central_edition_short, cmk_version.__version__, cmk_version.edition().short, ): raise MKGeneralException( _("Your central site (Version: %s, Edition: %s) is incompatible with this " "remote site (Version: %s, Edition: %s)") % ( central_version, central_edition_short, cmk_version.__version__, cmk_version.edition().short, ))