MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / validate_debug

Function validate_debug

web/pgadmin/tools/debugger/__init__.py:722–773  ·  view source on GitHub ↗

This function is used to validate the options required for debugger. :param conn: :param debug_type: :param is_superuser: :return:

(conn, debug_type, is_superuser)

Source from the content-addressed store, hash-verified

720
721
722def validate_debug(conn, debug_type, is_superuser):
723 """
724 This function is used to validate the options required for debugger.
725 :param conn:
726 :param debug_type:
727 :param is_superuser:
728 :return:
729 """
730 if debug_type == 'indirect':
731 if not is_superuser:
732 # If user is super user then we should check debugger library is
733 # loaded or not
734 msg = gettext("You must be a superuser to set a global breakpoint"
735 " and perform indirect debugging.")
736 return False, internal_server_error(errormsg=msg)
737
738 status, rid_pre = conn.execute_scalar(
739 "SHOW shared_preload_libraries"
740 )
741
742 if not status:
743 return False, internal_server_error(
744 gettext("Could not fetch debugger plugin information.")
745 )
746
747 # Need to check if plugin is really loaded or not with
748 # "plugin_debugger" string
749 if "plugin_debugger" not in rid_pre:
750 msg = gettext(
751 "The debugger plugin is not enabled. "
752 "Please add the plugin to the shared_preload_libraries "
753 "setting in the postgresql.conf file and restart the "
754 "database server for indirect debugging."
755 )
756 current_app.logger.debug(msg)
757 return False, internal_server_error(msg)
758
759 # Check debugger extension version for EPAS 11 and above.
760 # If it is 1.0 then return error to upgrade the extension.
761 status, ext_version = conn.execute_scalar(
762 "SELECT installed_version FROM pg_catalog.pg_available_extensions "
763 "WHERE name = 'pldbgapi'"
764 )
765 if not status:
766 return False, internal_server_error(errormsg=ext_version)
767 if conn.manager.server_type == 'ppas' and conn.manager.sversion >= 110000 \
768 and float(ext_version) < 1.1:
769 return False, internal_server_error(
770 errormsg=gettext("Please upgrade the pldbgapi extension "
771 "to 1.1 or above and try again."))
772
773 return True, None
774
775
776def get_search_path(conn):

Callers 1

initialize_targetFunction · 0.85

Calls 3

internal_server_errorFunction · 0.90
gettextFunction · 0.85
execute_scalarMethod · 0.45

Tested by

no test coverage detected