def get_tomcat_version(self, tomcat_version_script):
     for tomcat_instance in FindFiles.find_files(GENERIC_BINARY_LOCATION, tomcat_version_script):
         version_script = ErrorHelper.identify_problem(tomcat_instance, "tomcat")
         found_tomcat_version = version_script.split()[27]
         tomcat_location = version_script.split()[2].split("/")[-1]
         addme = tomcat_location + ": " + found_tomcat_version + "; "
         self.all_tomcat_versions.append(addme)
     self.all_tomcat_versions.append(",")
 def find_mongodb(self, mongo_server=None):
     mongo_dir = "/usr/local/mongodb/bin"
     # The vis servers do not seem to follow a standard for mongo paths so we have to hack around it
     # I am hoping that there is only one version of mongo installed on the vis server or this will break
     if mongo_server == "vis_mongodb_server":
         mongo_dir = "/usr/local/mongodb"
     mongo_binary = "mongo"
     mongo_command = mongo_dir + os.sep + mongo_binary + " --version"
     found_mongo_version = ErrorHelper.identify_problem(mongo_command, "MongoDB").split()[3].strip(",")
     return(found_mongo_version)
 def get_tomcat_version(self, tomcat_version_script):
     for tomcat_instance in FindFiles.find_files(GENERIC_BINARY_LOCATION,
                                                 tomcat_version_script):
         version_script = ErrorHelper.identify_problem(
             tomcat_instance, "tomcat")
         found_tomcat_version = version_script.split()[27]
         tomcat_location = version_script.split()[2].split("/")[-1]
         addme = tomcat_location + ": " + found_tomcat_version + "; "
         self.all_tomcat_versions.append(addme)
     self.all_tomcat_versions.append(",")
 def find_mongodb(self, mongo_server=None):
     mongo_dir = "/usr/local/mongodb/bin"
     # The vis servers do not seem to follow a standard for mongo paths so we have to hack around it
     # I am hoping that there is only one version of mongo installed on the vis server or this will break
     if mongo_server == "vis_mongodb_server":
         mongo_dir = "/usr/local/mongodb"
     mongo_binary = "mongo"
     mongo_command = mongo_dir + os.sep + mongo_binary + " --version"
     found_mongo_version = ErrorHelper.identify_problem(
         mongo_command, "MongoDB").split()[3].strip(",")
     return (found_mongo_version)
 def get_version_from_manifest(self, component_list):
     for autodata_component in component_list:
         if "backups" not in autodata_component and "purged" not in autodata_component.lower():
             check_manifest_command = "unzip -p %s META-INF/MANIFEST.MF" % autodata_component
             check_warfile = ErrorHelper.identify_problem(check_manifest_command,
                                                          autodata_component)
             for line in check_warfile.split("\n"):
                 # The manifest file should have a line that starts with the word "version"
                 # so look for case-insensitive
                 if line.lower().startswith("version") or line.startswith("Implementation-Version"):
                     component_with_path_removed = autodata_component.split("/")[-1] + ": \t" + line.split()[1]
                     if component_with_path_removed in self.found_manifest_version:
                         pass
                     else:
                         self.found_manifest_version.append(component_with_path_removed)
 def get_version_from_manifest(self, component_list):
     for autodata_component in component_list:
         if "backups" not in autodata_component and "purged" not in autodata_component.lower(
         ):
             check_manifest_command = "unzip -p %s META-INF/MANIFEST.MF" % autodata_component
             check_warfile = ErrorHelper.identify_problem(
                 check_manifest_command, autodata_component)
             for line in check_warfile.split("\n"):
                 # The manifest file should have a line that starts with the word "version"
                 # so look for case-insensitive
                 if line.lower().startswith("version") or line.startswith(
                         "Implementation-Version"):
                     component_with_path_removed = autodata_component.split(
                         "/")[-1] + ": \t" + line.split()[1]
                     if component_with_path_removed in self.found_manifest_version:
                         pass
                     else:
                         self.found_manifest_version.append(
                             component_with_path_removed)
 def get_openssl_version(self):
     openssl_path = "/usr/bin/openssl"
     ssl_command = "%s version" % openssl_path
     self.ssl_version = ErrorHelper.identify_problem(ssl_command, "OpenSSL").split()[1]
 def get_apache_version(self):
     httpd_path = "/usr/sbin/httpd"
     version_command = httpd_path + " -v"
     self.apache_version = ErrorHelper.identify_problem(version_command, "Apache").split()[2].split("/")[1].rstrip()
 def find_mysql(self):
     mysqld_location = "/usr/sbin/mysqld"
     mysql_command = mysqld_location + " --version"
     found_mysql_version = ErrorHelper.identify_problem(mysql_command, "MySQL").split()[2].strip(",")
     return(found_mysql_version)
 def get_openssl_version(self):
     openssl_path = "/usr/bin/openssl"
     ssl_command = "%s version" % openssl_path
     self.ssl_version = ErrorHelper.identify_problem(
         ssl_command, "OpenSSL").split()[1]
 def get_apache_version(self):
     httpd_path = "/usr/sbin/httpd"
     version_command = httpd_path + " -v"
     self.apache_version = ErrorHelper.identify_problem(
         version_command, "Apache").split()[2].split("/")[1].rstrip()
 def find_mysql(self):
     mysqld_location = "/usr/sbin/mysqld"
     mysql_command = mysqld_location + " --version"
     found_mysql_version = ErrorHelper.identify_problem(
         mysql_command, "MySQL").split()[2].strip(",")
     return (found_mysql_version)