Introduce Gerrit Inspector: interactive Jython shell
Adds "-s" option to com.google.gerrit.pgm.Daemon to start an interactive Jython shell for inspection and troubleshooting of live data of the Gerrit instance. Gerrit Inspector is an interactive scriptable environment to inspect and modify internal state of the system. This environment is available on the system console after the system starts. Leaving the Inspector will shutdown the Gerrit instance. The environment allows interactive work as well as running of Python scripts for troubleshooting. Accessing Java Virtual Machine objects and calling Java methods is possible. Gerrit Inspect can be started by adding -s option to the command used to launch the daemon: java -jar buck-out/gen/gerrit.war daemon -d ../test_site -s For more information on this facility please see: Documentation/dev-inspector.txt Implementation remark: Jython needs to examine available .jar files on startup. It does so currently by reading contents of the WAR archive unpacked by GerritLauncher in the temporary directory. Jython is able to store this information persistently, but it does not currently work because we unpack WAR file every time on startup. Currently no attempt is made to introspect Guice bindings. Change-Id: I47ffc8383fd50bc6ec12ba31edb6d7d614e97bd5
This commit is contained in:
committed by
Shawn Pearce
parent
aebbe03e4f
commit
ed612fb44a
@@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2013 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Startup script for Gerrit Inspector - a Jython introspector
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
|
||||
def help():
|
||||
for (n, v) in vars(sys.modules['__main__']).items():
|
||||
if not n.startswith("__") and not n in ['help', 'reload'] \
|
||||
and str(type(v)) != "<type 'javapackage'>" \
|
||||
and not str(v).startswith("<module"):
|
||||
print "\"%s\" is \"%s\"" % (n, v)
|
||||
print
|
||||
print "Welcome to the Gerrit Inspector"
|
||||
print "Enter help() to see the above again, EOF to quit and stop Gerrit"
|
||||
|
||||
help()
|
||||
Reference in New Issue
Block a user