On 11.12.2015 17:28, Oleg Fayans wrote:
+    myre = re.compile(".*Backed up to (?P<backup>.*?)\n.*")

IMO this regexp is not good.

1)
please name it better than "myre"

2)
initial '.*' is not needed because regexp does not start with '^' and you use search() later

3)

trailing '.*' is not needed as well, because it does not end with '$'

4)
You can use re.MULTILINE that will parse string per lines

path_re = re.compile("^Backed up to (?P<backup>.*)$", re.MULTILINE)

5)
+    matched = myre.search(result.stdout_text + result.stderr_text)
Why do you need search in both stderr and stdout?

Martin^2


--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to