File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 # positive matches, so this needs to be done manually in setcode.
2323 setcode do
2424 unless [ 'openbsd' , 'darwin' ] . include? Facter . value ( :operatingsystem ) . downcase
25+ version = nil
2526 if Facter ::Util ::Resolution . which ( 'java' )
26- Facter ::Util ::Resolution . exec ( 'java -Xmx12m -version 2>&1' ) . lines . first . split ( /"/ ) [ 1 ] . strip
27+ Facter ::Util ::Resolution . exec ( 'java -Xmx12m -version 2>&1' ) . lines . each { | line | version = $~ [ 1 ] if /^.+ version \" (.+) \" $/ =~ line }
2728 end
29+ version
2830 end
2931 end
3032end
3436 has_weight 100
3537 setcode do
3638 Facter ::Util ::Resolution . with_env ( "PATH" => '/usr/local/jdk-1.7.0/jre/bin:/usr/local/jre-1.7.0/bin' ) do
39+ version = nil
3740 if Facter ::Util ::Resolution . which ( 'java' )
38- Facter ::Util ::Resolution . exec ( 'java -Xmx12m -version 2>&1' ) . lines . first . split ( /"/ ) [ 1 ] . strip
41+ Facter ::Util ::Resolution . exec ( 'java -Xmx12m -version 2>&1' ) . lines . each { | line | version = $~ [ 1 ] if /^.+ version \" (.+) \" $/ =~ line }
3942 end
43+ version
4044 end
4145 end
4246end
4650 has_weight 100
4751 setcode do
4852 unless /Unable to find any JVMs matching version/ =~ Facter ::Util ::Resolution . exec ( '/usr/libexec/java_home --failfast 2>&1' )
49- Facter ::Util ::Resolution . exec ( 'java -Xmx12m -version 2>&1' ) . lines . first . split ( /"/ ) [ 1 ] . strip
53+ version = nil
54+ Facter ::Util ::Resolution . exec ( 'java -Xmx12m -version 2>&1' ) . lines . each { |line | version = $~[ 1 ] if /^.+ version \" (.+)\" $/ =~ line }
55+ version
5056 end
5157 end
5258end
Original file line number Diff line number Diff line change 1414 let ( :facts ) { { :operatingsystem => 'OpenBSD' } }
1515 it do
1616 java_version_output = <<-EOS
17+ Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
1718openjdk version "1.7.0_71"
1819OpenJDK Runtime Environment (build 1.7.0_71-b14)
1920OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
3031 let ( :facts ) { { :operatingsystem => 'Darwin' } }
3132 it do
3233 java_version_output = <<-EOS
34+ Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
3335java version "1.7.0_71"
3436Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
3537Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
4648 let ( :facts ) { { :operatingsystem => 'MyOS' } }
4749 it do
4850 java_version_output = <<-EOS
51+ Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
4952java version "1.7.0_71"
5053Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
5154Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
You can’t perform that action at this time.
0 commit comments