PackageProvidesJavaAll - Combiner for packages which provide java

Warning

This module is deprecated, please use insights.parsers.package_provides instead.

Combiner for collecting all the java command and the corresponding package name which is parsed by the PackageProvidesJava parser.

class insights.combiners.package_provides_java.PackageProvidesJavaAll(package_provides_java)[source]

Bases: insights.core.LegacyItemAccess

Warning

This Combiner is deprecated, please use insights.parsers.package_provides.PackageProvidesCommand Parser instead.

Combiner for collecting all the java command and the corresponding package name which is parsed by the PackageProvidesJava parser. It works as a dict with the java command as the key and the corresponding package name as the value.

Examples

>>> PACKAGE_COMMAND_MATCH_1 = '''/usr/lib/jvm/jre/bin/java java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64'''
>>> PACKAGE_COMMAND_MATCH_2 = '''/usr/lib/jvm/java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64/bin/java java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64'''
>>> pack1 = PackageProvidesJava(context_wrap(PACKAGE_COMMAND_MATCH_1))
>>> pack2 = PackageProvidesJava(context_wrap(PACKAGE_COMMAND_MATCH_2))
>>> shared = [{PackageProvidesJavaAll: [pack1, pack2]}]
>>> packages = shared[PackageProvidesJavaAll]
>>> packages.running_javas
['/usr/lib/jvm/jre/bin/java',
 '/usr/lib/jvm/java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64/bin/java']
>>> packages.get_package("/usr/lib/jvm/jre/bin/java")
'java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64'
>>> packages.get("/usr/lib/jvm/jre/bin/java")
'java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64'
>>> packages["/usr/lib/jvm/jre/bin/java"]
'java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64'
get_package(java_command)[source]

Returns the installed java package that provides the specified java_command.

Parameters

java_command (str) -- The specified java command, e.g. found in ps command.

Returns

The package that provides the java command.

Return type

(str)

property running_javas

Returns the list of java commands which are running on the system.