def test_05_start_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) core.state['tomcat.started'] = False catalina_log = tomcat.catalinafile() initial_stat = core.get_stat(catalina_log) tomcat_sentinel = r'Server startup in \d+ ms' # Bump log level core.config['tomcat.logging-conf'] = os.path.join(tomcat.sysconfdir(), 'logging.properties') files.append(core.config['tomcat.logging-conf'], 'org.apache.catalina.level = %s\n' % 'FINER', owner='tomcat', backup=True) old_str = "1catalina.org.apache.juli.FileHandler.prefix = catalina." repl_str = ("1catalina.org.apache.juli.FileHandler.prefix = catalina\n" "1catalina.org.apache.juli.FileHandler.rotatable = false") files.replace(core.config['tomcat.logging-conf'], old_str, repl_str, owner='tomcat', backup=False) service.check_start(tomcat.pkgname()) if core.options.nightly: timeout = 3600.0 else: timeout = 1200.0 line, gap = core.monitor_file(catalina_log, initial_stat, tomcat_sentinel, timeout) self.assert_(line is not None, 'Tomcat did not start within the %d min window' % int(timeout/60)) core.state['tomcat.started'] = True core.log_message('Tomcat started after %.1f seconds' % gap)
def test_05_start_tomcat(self): if not core.rpm_is_installed(tomcat.pkgname()): core.skip('not installed') return service.start('tomcat', init_script=tomcat.pkgname(), sentinel_file=tomcat.pidfile())
def test_05_start_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) if core.el_release() == 7: # tomcat on el7 doesn't seem to actually use its always-present pidfile... service.start('tomcat', init_script=tomcat.pkgname()) else: service.start('tomcat', init_script=tomcat.pkgname(), sentinel_file=tomcat.pidfile())
def test_06_remove_trustmanager(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat') # mv -f /etc/tomcat5/server.xml.old-trustmanager /etc/tomcat5/server.xml old_tm = os.path.join(tomcat.sysconfdir(), 'server.xml.old-trustmanager') new_tm = os.path.join(tomcat.sysconfdir(), 'server.xml') if os.path.exists(old_tm) and os.path.isdir(os.path.dirname(new_tm)): shutil.move(old_tm, new_tm) # rm -f /usr/share/tomcat5/server/lib/bcprov*.jar files.remove(os.path.join(tomcat.serverlibdir(), 'bcprov*.jar')) # rm -f /usr/share/tomcat5/server/lib/log4j*.jar files.remove(os.path.join(tomcat.serverlibdir(), 'log4j*.jar')) # rm -f /usr/share/tomcat5/server/lib/trustmanager-*.jar files.remove(os.path.join(tomcat.serverlibdir(), 'trustmanager-*.jar')) # rm -f /etc/tomcat5/log4j-trustmanager.properties files.remove( os.path.join(tomcat.sysconfdir(), 'log4j-trustmanager.properties')) # rm -f /var/lib/trustmanager-tomcat/server.xml files.remove('/var/lib/trustmanager-tomcat/server.xml') core.log_message('EMI trustmanager removed')
def test_03_record_vomsadmin_start(self): core.state['voms.webapp-log-stat'] = None if core.missing_rpm(tomcat.pkgname(), 'voms-admin-server'): return if os.path.exists(core.config['voms.webapp-log']): core.state['voms.webapp-log-stat'] = \ os.stat(core.config['voms.webapp-log'])
def test_06_remove_trustmanager(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat') # mv -f /etc/tomcat5/server.xml.old-trustmanager /etc/tomcat5/server.xml old_tm = os.path.join(tomcat.sysconfdir(), 'server.xml.old-trustmanager') new_tm = os.path.join(tomcat.sysconfdir(), 'server.xml') if os.path.exists(old_tm) and os.path.isdir(os.path.dirname(new_tm)): shutil.move(old_tm, new_tm) # rm -f /usr/share/tomcat5/server/lib/bcprov*.jar files.remove(os.path.join(tomcat.serverlibdir(), 'bcprov*.jar')) # rm -f /usr/share/tomcat5/server/lib/log4j*.jar files.remove(os.path.join(tomcat.serverlibdir(), 'log4j*.jar')) # rm -f /usr/share/tomcat5/server/lib/trustmanager-*.jar files.remove(os.path.join(tomcat.serverlibdir(), 'trustmanager-*.jar')) # rm -f /etc/tomcat5/log4j-trustmanager.properties files.remove(os.path.join(tomcat.sysconfdir(), 'log4j-trustmanager.properties')) # rm -f /var/lib/trustmanager-tomcat/server.xml files.remove('/var/lib/trustmanager-tomcat/server.xml') core.log_message('EMI trustmanager removed')
def test_04_config_tomcat_endorsed_jars(self): core.skip_ok_unless_installed(tomcat.pkgname()) old_contents = files.read(tomcat.conffile(), True) line = 'JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"\n' if old_contents.find(line) == -1: new_contents = old_contents + "\n" + line files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_10_fix_tomcat_template(self): # Fix EL7 bug in Gratia template if core.el_release() == 7: core.skip_ok_unless_installed(tomcat.pkgname(), 'gratia-service') core.config['gratia.broken_template'] = '/usr/share/gratia/server.xml.template' bad_line = r'\s+sSLImplementation=.*' fixed_line = ' '*15 + 'sslImplementationName="org.glite.security.trustmanager.tomcat.TMSSLImplementation"' files.replace_regexpr(core.config['gratia.broken_template'], bad_line, fixed_line, owner='gratia')
def test_02_config_tomcat_properties(self): if core.missing_rpm(tomcat.pkgname(), 'emi-trustmanager-tomcat'): return server_xml_path = os.path.join(tomcat.sysconfdir(), 'server.xml') old_contents = files.read(server_xml_path, True) pattern = re.compile(r'crlRequired=".*?"', re.IGNORECASE) new_contents = pattern.sub('crlRequired="false"', old_contents) files.write(server_xml_path, new_contents, owner='tomcat')
def test_04_config_tomcat_endorsed_jars(self): if core.missing_rpm(tomcat.pkgname()): return old_contents = files.read(tomcat.conffile(), True) line = 'JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"\n' if old_contents.find(line) == -1: new_contents = old_contents + "\n" + line files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_02_config_tomcat_properties(self): if core.missing_rpm(tomcat.pkgname(), 'emi-trustmanager-tomcat'): return server_xml_path = os.path.join(tomcat.sysconfdir(), 'server.xml') old_contents = files.read(server_xml_path, True) pattern = re.compile(r'crlRequired=".*?"', re.IGNORECASE) new_contents = pattern.sub('crlRequired="false"', old_contents) files.write(server_xml_path, new_contents, owner='tomcat')
def test_03_disable_persistence(self): core.skip_ok_unless_installed(tomcat.pkgname()) self.skip_ok_if(core.options.nightly, 'Allow persistence in the nightlies') contents=''' <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Manager pathname="" /> </Context> ''' files.write(tomcat.contextfile(), contents, owner='tomcat')
def test_03_disable_persistence(self): core.skip_ok_unless_installed(tomcat.pkgname()) self.skip_ok_if(core.options.nightly, 'Allow persistence in the nightlies') contents = ''' <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Manager pathname="" /> </Context> ''' files.write(tomcat.contextfile(), contents, owner='tomcat')
def test_04_config_tomcat_properties(self): if core.missing_rpm(tomcat.pkgname(), 'gratia-service'): return command = ('/usr/share/gratia/configure_tomcat',) core.check_system(command, 'Unable to configure Gratia.') server_xml_path = os.path.join(tomcat.sysconfdir(), 'server.xml') files.replace_regexpr(server_xml_path, "(<Server.*\n)", r'\1<Listener className="org.apache.catalina.core.JasperListener"/>', owner='gratia', backup=True)
def test_04_config_tomcat_properties(self): if core.missing_rpm(tomcat.pkgname(), 'gratia-service'): return command = ('/usr/share/gratia/configure_tomcat', ) core.check_system(command, 'Unable to configure Gratia.') server_xml_path = os.path.join(tomcat.sysconfdir(), 'server.xml') files.replace_regexpr( server_xml_path, "(<Server.*\n)", r'\1<Listener className="org.apache.catalina.core.JasperListener"/>', owner='gratia', backup=True)
def test_05_start_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) core.state['tomcat.started'] = False catalina_log = tomcat.catalinafile() initial_stat = core.get_stat(catalina_log) tomcat_sentinel = r'Server startup in \d+ ms' # Bump log level core.config['tomcat.logging-conf'] = os.path.join( tomcat.sysconfdir(), 'logging.properties') files.append(core.config['tomcat.logging-conf'], 'org.apache.catalina.level = %s\n' % 'FINER', owner='tomcat', backup=True) old_str = "1catalina.org.apache.juli.FileHandler.prefix = catalina." repl_str = ("1catalina.org.apache.juli.FileHandler.prefix = catalina\n" "1catalina.org.apache.juli.FileHandler.rotatable = false") files.replace(core.config['tomcat.logging-conf'], old_str, repl_str, owner='tomcat', backup=False) service.check_start(tomcat.pkgname()) if core.options.nightly: timeout = 3600.0 else: timeout = 1200.0 line, gap = core.monitor_file(catalina_log, initial_stat, tomcat_sentinel, timeout) self.assert_( line is not None, 'Tomcat did not start within the %d min window' % int(timeout / 60)) core.state['tomcat.started'] = True core.log_message('Tomcat started after %.1f seconds' % gap)
def test_02_config_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) old_contents = files.read(tomcat.conffile(), True) # Endorse JARs lines = ['JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"'] # Improve Tomcat 7 startup times (SOFTWARE-2383) lines.append('JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"') for line in lines: if old_contents.find(line) != -1: lines.remove(line) new_contents = '\n'.join([old_contents] + lines) files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_02_config_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) old_contents = files.read(tomcat.conffile(), True) # Endorse JARs lines = [ 'JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"' ] # Improve Tomcat 7 startup times (SOFTWARE-2383) lines.append('JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"') for line in lines: if old_contents.find(line) != -1: lines.remove(line) new_contents = '\n'.join([old_contents] + lines) files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_07_deconfig_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) files.restore(tomcat.conffile(), 'tomcat')
def test_05_deconfig_tomcat(self): if core.missing_rpm(tomcat.pkgname()): return files.restore(tomcat.conffile(), 'tomcat')
def test_01_config_trustmanager(self): if core.missing_rpm(tomcat.pkgname(), 'emi-trustmanager-tomcat'): return command = ('/var/lib/trustmanager-tomcat/configure.sh', ) core.check_system(command, 'Config trustmanager')
def test_01_config_trustmanager(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat') command = ('/var/lib/trustmanager-tomcat/configure.sh', ) core.check_system(command, 'Config trustmanager')
def test_03_deconfig_tomcat_properties(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat') files.restore(os.path.join(tomcat.sysconfdir(), 'server.xml'), 'tomcat')
def test_09_stop_tomcat(self): core.skip_ok_unless_installed('gratia-service') core.skip_ok_unless_installed(tomcat.pkgname()) service.stop('tomcat')
def test_01_stop_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) self.skip_bad_unless(core.state['tomcat.started'], 'Tomcat not started') service.check_stop(tomcat.pkgname())
def test_03_deconfig_tomcat_properties(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'gratia-service') files.restore(os.path.join(tomcat.sysconfdir(), 'server.xml'), 'gratia')
def test_07_deconfig_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) files.restore(tomcat.conffile(), 'tomcat')
def test_05_deconfig_context(self): core.skip_ok_unless_installed(tomcat.pkgname()) self.skip_ok_if(core.options.nightly, 'Allow persistence in the nightlies') files.restore(tomcat.contextfile(), 'tomcat')
def test_03_deconfig_tomcat_properties(self): if core.missing_rpm(tomcat.pkgname(), 'emi-trustmanager-tomcat'): return files.restore(os.path.join(tomcat.sysconfdir(), 'server.xml'), 'tomcat')
def test_04_deconfig_catalina_logging(self): core.skip_ok_unless_installed(tomcat.pkgname()) files.restore(core.config['tomcat.logging-conf'], 'tomcat')
def test_05_deconfig_context(self): core.skip_ok_unless_installed(tomcat.pkgname()) self.skip_ok_if(core.options.nightly, 'Allow persistence in the nightlies') files.restore(tomcat.contextfile(), 'tomcat')
def test_13_restore_tomcat_template(self): if core.el_release() == 7: core.skip_ok_unless_installed(tomcat.pkgname(), 'gratia-service') files.restore(core.config['gratia.broken_template'], 'gratia')
def test_01_config_trustmanager(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat') command = ('/var/lib/trustmanager-tomcat/configure.sh',) core.check_system(command, 'Config trustmanager')
def test_01_stop_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) self.skip_bad_unless(core.state['tomcat.started'], 'Tomcat not started') service.check_stop(tomcat.pkgname())
def test_03_record_vomsadmin_start(self): core.state['voms.webapp-log-stat'] = None core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat') if os.path.exists(core.config['voms.webapp-log']): core.state['voms.webapp-log-stat'] = \ os.stat(core.config['voms.webapp-log'])
def test_03_deconfig_tomcat_properties(self): core.skip_ok_unless_installed(tomcat.pkgname(), 'gratia-service') files.restore(os.path.join(tomcat.sysconfdir(), 'server.xml'), 'gratia')
def test_04_deconfig_catalina_logging(self): core.skip_ok_unless_installed(tomcat.pkgname()) files.restore(core.config['tomcat.logging-conf'], 'tomcat')
def test_01_stop_tomcat(self): if not core.rpm_is_installed(tomcat.pkgname()): core.skip('not installed') return service.stop('tomcat')