How to get tomcat_version to display the whole version of tomcat in script instead of just the first number

asked 2017-12-14 17:24:12 -0600

athlonxl gravatar image

With the input provided to me from this site i was able to modify a script that match what i needed for my tomcat_version fact. The only problem is that it does not display the whole version of the tomcat file just the one number like tomcat 6, 7, 9 instead of 6.2.1 for example. This wouldn't be a problem if it wasn't for another class reference this file that being the case i need a way to display the full version of tomcat. Avoiding using the version.bat file since it has cause us some issues and we are trying to move away from it .

Facter.add(:tomcat_version) do
  confine :kernel => 'windows'

  setcode do
    if version = Dir.glob('C:\guidewire\bin\tomcat?.exe').sort().last()
    version = version.match(/\d+/) if version.is_a?(String)
  else 
    version = 'Tomcat not installed'
  end
end
end

example of what its shows right now

image description

edit retag flag offensive close merge delete

Comments

Let me DuckDuckGo that for you. Can't you just do, what the version.sh script does? Locate the catalina.jar, extract org/apache/catalina/util/ServerInfo.properties from it, and read the server.number property.

Kai Burghardt gravatar imageKai Burghardt ( 2017-12-19 15:37:53 -0600 )edit