mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64. It also makes the code a bit shorter.
This commit is contained in:
committed by
Michael DeHaan
parent
a7da5d8702
commit
0749112286
@@ -138,7 +138,7 @@ def iscsi_get_cached_nodes(module, portal=None):
|
||||
# older versions of scsiadm don't have nice return codes
|
||||
# for newer versions see iscsiadm(8); also usr/iscsiadm.c for details
|
||||
# err can contain [N|n]o records...
|
||||
elif rc == 21 or (rc == 255 and err.find("o records found") != -1):
|
||||
elif rc == 21 or (rc == 255 and "o records found" in err):
|
||||
nodes = []
|
||||
else:
|
||||
module.fail_json(cmd=cmd, rc=rc, msg=err)
|
||||
|
||||
Reference in New Issue
Block a user