2013/1/30 Bernardo Dal Seno <[email protected]>:
> --- a/qa/qa_cluster.py
> +++ b/qa/qa_cluster.py
> +# "gnt-cluster info" fields
> +_CIFIELD_RE = re.compile(r"^[-\s]*([^\s:]+):\s*(\S.*)$")
> +
> +
> +def _GetBoolClusterField(field):
> +  master = qa_config.GetMasterNode()
> +  infocmd = "gnt-cluster info"

Please use a list: ["gnt-cluster", "info"]

> +  info_out = qa_utils.GetCommandOutput(master["primary"], infocmd)
> +  ret = None
> +  for l in info_out.splitlines():
> +    m = _CIFIELD_RE.match(l)
> +    # FIXME: There should be a way to specify a field through a hierarchy
> +    if m and m.group(1) == field:
> +      assert ret is None
> +      if m.group(2).lower() == "true":

If you use named groups (“(?P<name>…)” you can use “m.group("name")”.

> +        ret = True
> +      else:
> +        ret = False

Why not just “ret = (m.group(2).lower() == "true")”

Shouldn't you abort the loop here using “break”? After all you assert
for “ret” to be None just above.

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.


Reply via email to