>>> Kristoffer Grönlund <[email protected]> schrieb am 12.11.2014 um 22:52 in
Nachricht <[email protected]>:
[...]
>> self.supported_cib_re = "^pacemaker-([12][.][0123]|next)$"

I'm no Python programmer, but this looks as if the version pattern is reduced
to a Boolean value. While the pattern looks OK, and it will match all the
desired versions (I guess), it may (especially when extended that way) also
match versions that may not be desired (does "2.3next" exist already?).

        if not re.match(self.supported_cib_re, schema_st):
            common_err("schema %s not supported by the shell" % schema_st)
            return False

Therefore I suggest:
self.cib_version = "^pacemaker-([0-9]+[.][0-9]|next)$"

then check whether version is "next"; otherwise compare the numbers a such,
i.e. 1.0 < number && number < whatever. In Perl I'd use this REGEXP:
"^pacemaker-(\d+(?:\.\d+)|next)$". Are the version numbers really like
"pakemaker-next", or are they like "pacemaker-1.2next"? If so the regex would
be "^pacemaker-(\d+(?:\.\d+)(?:next)?)$"

(In Perl)
supported_cib = $1 =~ /^(?:1.0|1.1|...|2.0next)$/; # "..." is to be replaced,
of course!

Regards,
Ulrich

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to