Ejemplo n.º 1
0
def is_pcmk_datespec_part(
    value: str,
    at_least: Optional[int] = None,
    at_most: Optional[int] = None,
) -> bool:
    """
    Check if the value is a valid Pacemaker Datespec part:
      * int or int1-int2
      * int in specified range
      * int2 > int1
    """
    match = _PCMK_DATESPEC_PART_RE.fullmatch(value)
    if not match:
        return False
    if not is_integer(match["since"], at_least, at_most):
        return False
    if match["until"] is not None:
        if not is_integer(match["until"], at_least, at_most):
            return False
        if int(match["since"]) >= int(match["until"]):
            return False
    return True
Ejemplo n.º 2
0
 def _is_valid(self, value: TypeOptionValue) -> bool:
     return is_integer(value, self._at_least, self._at_most)
Ejemplo n.º 3
0
 def _is_valid(self, value: TypeOptionValue) -> bool:
     return is_integer(value, 1)
Ejemplo n.º 4
0
Archivo: sbd.py Proyecto: kmalyjur/pcs
 def _is_valid(self, value: validate.TypeOptionValue) -> bool:
     return is_integer(value, self._threshold + 1)