Beispiel #1
0
 def testToRetcode(self):
     "utils.to_retcode()"
     for s in (0, 'OK', 'ok', 'Ok'):
         assert 0 == samutils.to_retcode(s)
     for s in (1, 'WARNING', 'warning', 'Warning'):
         assert 1 == samutils.to_retcode(s)
     for s in (2, 'CRITICAL', 'critical', 'Critical'):
         assert 2 == samutils.to_retcode(s)
     for s in (3, 'UNKNOWN', 'Unknown', 'Bad Input'):
         assert 3 == samutils.to_retcode(s)
Beispiel #2
0
 def testToRetcode(self):
     "utils.to_retcode()"
     for s in (0, 'OK', 'ok', 'Ok'):
         assert 0 == samutils.to_retcode(s)
     for s in (1, 'WARNING', 'warning', 'Warning'):
         assert 1 == samutils.to_retcode(s)
     for s in (2, 'CRITICAL', 'critical', 'Critical'):
         assert 2 == samutils.to_retcode(s)
     for s in (3, 'UNKNOWN', 'Unknown', 'Bad Input'):
         assert 3 == samutils.to_retcode(s)
Beispiel #3
0
                    if rc != 0:
                        if not proto in nok:
                            nok.append(proto)
                        self.printd('proto: %s - FAILED' % proto)
                        self.printd('error: %s' % errmsg)
                        em = probe.ErrorsMatching(self.errorDBFile, self.errorTopics)
                        er = em.match(errmsg)
                        if er:
                            status = er[0][2]
                        else:
                            status = 'CRITICAL'
                    else:
                        if not proto in ok:
                            ok.append(proto)
                        self.printd('proto: %s - OK' % proto)
                        if not samutils.to_retcode(status) > samutils.to_retcode('OK'):
                            status = 'OK'
                self.print_time()
                self.printd('-----')

        summary = 'protocols OK-[%s]' % ', '.join([x for x in ok])
        if nok:
            summary += ', FAILED-[%s]' % ', '.join([x for x in nok])

        return (status, summary)

    def metricGet(self):
        "Copy given remote file(s) from SRM to a local file."

        self.printd(self.lcg_util_gfal_ver)