2013/1/30 Bernardo Dal Seno <[email protected]>:
> --- a/qa/qa_cluster.py
> +++ b/qa/qa_cluster.py
> +# Cluster-verify errors (date, "ERROR", then error code)
> +_CVERROR_RE = re.compile(r"^[A-Z][a-z]{2} [A-Z][a-z]{2} [0-9]{2}"
> + " [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}"
> + "\s+- ERROR:([A-Z0-9_-]+):")
I think this is a bit too strict. Can't you just match for “^[\w ]+\s+- ERROR…”?
Also, you must repeat the “r” (for raw strings) for each fragment.
> +def AssertClusterVerify(fail=False, errors=None):
> + cvcmd = "gnt-cluster verify"
Please use the non-shell version: ["gnt-cluster", "verify"]
> + mnode = qa_config.GetMasterNode()
> + if errors:
> + cvout = GetCommandOutput(mnode["primary"], cvcmd + " --error-codes",
+ ["--error-codes"]
> + fail=True)
> + actual = _GetCVErrorCodes(cvout)
> + expected = compat.UniqueFrozenset(map(lambda e: e[1], errors))
map(compat.snd, errors)
However, maybe you should just use explicit unpacking.
> + if not actual.issuperset(expected):
> […]
> --- a/qa/qa_utils.py
> +++ b/qa/qa_utils.py
> +def _AssertRetCode(rcode, fail, cmdstr, nodename):
> + """Check the return value from a command and possibly raise an exception.
> +
> + """
> + if fail:
> + if rcode == 0:
> + raise qa_error.Error("Command '%s' on node %s was expected to fail but"
> + " didn't" % (cmdstr, nodename))
> + else:
> + if rcode != 0:
elif
> + raise qa_error.Error("Command '%s' on node %s failed, exit code %s" %
> + (cmdstr, nodename, rcode))
Michael
--
You received this message because you are subscribed to the Google Groups
"ganeti-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.