(self, request)
return 200, payload["check"]["attributes"]
Validate the check request payload and returns the response code
Validate the check request payload and returns the response code
Validate the check request payload and returns the response code
def validate_check_payload(self, request):
        """
        Validate the check request payload and returns the response code
        """
        content = request.content.read().decode("utf-8")
        try:
            payload = xmltodict.parse(content)
        except:
            return 500, None
        attributes = ["name", "module", "target", "period", "timeout",
                      "filterset"]
        for each in attributes:
            if not payload["check"]["attributes"].get(each):
                return 404, None
        return 200, payload["check"]["attributes"]
def validate_check_payload ( self , request ) : content = request . content . read ( ) . decode ( "utf-8" ) try : payload = xmltodict . parse ( content ) except : return 500 , None attributes = [ "name" , "module" , "target" , "period" , "timeout" , "filterset" ] for each in attributes : if not payload [ "check" ] [ "attributes" ] . get ( each ) : return 404 , None return 200 , payload [ "check" ] [ "attributes" ]