misplaced python 'or' causes dead code
Closed this issue · 0 comments
setharnold commented
fence-agents/agents/amt_ws/fence_amt_ws.py
Line 151 in 542fb6d
Hello, I'm giving fence-agents a very quick read as part of an Ubuntu main include request. Part of this includes looking through Coverity output, which flagged the following mistake:
elif options["--boot-option"] == "hd" or "hdsafe":
device = "Intel(r) AMT: Force Hard-drive Boot"
Because the string "hdsafe"
is always True
, the following elif
blocks will never match. You can see this with a simple test:
$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> if "a" == "b" or "c":
... print("oops")
...
oops
>>>
Thanks