aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Srb <michal@redhat.com>2017-08-21 16:29:23 +0200
committerBryn M. Reeves <bmr@redhat.com>2017-10-10 10:36:50 +0100
commit6fc42802b87f95dba1d6bfda49ae158143e7799c (patch)
tree7a2412b97189de2788a9896b3f5d5950bd8da295
parent32a4be0a005d16b6d9b7101bda008bdc0129d8e7 (diff)
downloadsos-6fc42802b87f95dba1d6bfda49ae158143e7799c.tar.gz
[jars] Scan only /usr/{share,lib}/java by default
Other known locations can be added via: -k jars.all_known_locations Additional user-specified locations can be added via: -k jars.append_locations=... Signed-off-by: Michal Srb <michal@redhat.com>
-rw-r--r--sos/plugins/jars.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/sos/plugins/jars.py b/sos/plugins/jars.py
index c6cba96b..486ac05f 100644
--- a/sos/plugins/jars.py
+++ b/sos/plugins/jars.py
@@ -31,7 +31,8 @@ class Jars(Plugin, RedHatPlugin):
profiles = ("java",)
option_list = [
("append_locations", "colon-separated list of additional JAR paths",
- "fast", "")
+ "fast", ""),
+ ("all_known_locations", "scan all known paths", "slow", False)
]
# There is no standard location for JAR files and scanning
@@ -39,7 +40,12 @@ class Jars(Plugin, RedHatPlugin):
# scan directories in which JARs can be typically found.
jar_locations = (
"/usr/share/java", # common location for JARs
- "/usr/lib/java", # common location for JARs containing native code
+ "/usr/lib/java" # common location for JARs containing native code
+ )
+
+ # Following paths can be optionally scanned as well. Note the scan can take
+ # *very* long time.
+ extra_jar_locations = (
"/opt", # location for RHSCL and 3rd party software
"/usr/local", # used by sysadmins when installing SW locally
"/var/lib" # Java services commonly explode WARs there
@@ -50,9 +56,13 @@ class Jars(Plugin, RedHatPlugin):
jar_paths = []
locations = list(Jars.jar_locations)
- extra_locations = self.get_option("append_locations")
- if extra_locations:
- locations += extra_locations.split(":")
+ if self.get_option("all_known_locations"):
+ locations += list(Jars.extra_jar_locations)
+
+ # append also user-defined locations, if any
+ user_locations = self.get_option("append_locations")
+ if user_locations:
+ locations += user_locations.split(":")
# find all JARs in given locations
for location in locations: