Exemple #1
0
def create_test(test_node, label, value, threshold):
    
    print value
    print threshold
    passed = True
    if value < threshold:
        passed = False
    
    print passed    
    test_x = Test(test_name=label, value=value, node_test=test_node, passed=passed)
    try:
        test_x.save()
    except IntegrityError as e:
        print "Integrity Error"
Exemple #2
0
def create_test(config,test_node,section,name,threshold):
    
    try:
        xdata = config.getfloat(section, name)
        passed = True
        if xdata < threshold:
            passed = False
            
        test_x = Test(test_name=name, value=xdata, node_test=test_node, threshold=threshold, passed=passed)
        try:
            test_x.save()
        except IntegrityError as e:
            pass

    except ConfigParser.NoOptionError:
        print "no options"
    except ConfigParser.NoSectionError:
        print "no sections"