Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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())
Exemplo n.º 3
0
 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())
Exemplo n.º 4
0
    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')
Exemplo n.º 5
0
 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'])
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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')
Exemplo n.º 8
0
 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')
Exemplo n.º 9
0
    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')
Exemplo n.º 10
0
    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')
Exemplo n.º 11
0
    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')
Exemplo n.º 12
0
    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')
Exemplo n.º 13
0
    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')
Exemplo n.º 14
0
    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)
Exemplo n.º 15
0
    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)
Exemplo n.º 16
0
    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)
Exemplo n.º 17
0
    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')
Exemplo n.º 18
0
    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')
Exemplo n.º 19
0
    def test_07_deconfig_tomcat(self):
        core.skip_ok_unless_installed(tomcat.pkgname())

        files.restore(tomcat.conffile(), 'tomcat')
Exemplo n.º 20
0
    def test_05_deconfig_tomcat(self):
        if core.missing_rpm(tomcat.pkgname()):
            return

        files.restore(tomcat.conffile(), 'tomcat')
Exemplo n.º 21
0
    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')
Exemplo n.º 22
0
    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')
Exemplo n.º 23
0
 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')
Exemplo n.º 24
0
 def test_09_stop_tomcat(self):
     core.skip_ok_unless_installed('gratia-service')
     core.skip_ok_unless_installed(tomcat.pkgname())
     service.stop('tomcat')
Exemplo n.º 25
0
 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())
Exemplo n.º 26
0
 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')
Exemplo n.º 27
0
    def test_07_deconfig_tomcat(self):
        core.skip_ok_unless_installed(tomcat.pkgname())

        files.restore(tomcat.conffile(), 'tomcat')
Exemplo n.º 28
0
 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')
Exemplo n.º 29
0
 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')
Exemplo n.º 30
0
 def test_04_deconfig_catalina_logging(self):
     core.skip_ok_unless_installed(tomcat.pkgname())
     files.restore(core.config['tomcat.logging-conf'], 'tomcat')
Exemplo n.º 31
0
 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')
Exemplo n.º 32
0
 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')
Exemplo n.º 33
0
    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')
Exemplo n.º 34
0
 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())
Exemplo n.º 35
0
 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'])
Exemplo n.º 36
0
 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')
Exemplo n.º 37
0
 def test_04_deconfig_catalina_logging(self):
     core.skip_ok_unless_installed(tomcat.pkgname())
     files.restore(core.config['tomcat.logging-conf'], 'tomcat')
Exemplo n.º 38
0
 def test_01_stop_tomcat(self):
     if not core.rpm_is_installed(tomcat.pkgname()):
         core.skip('not installed')
         return
     service.stop('tomcat')