Skip to content

Commit ca90985

Browse files
committed
Replace assert with condition
a piece of code in image client has some business logic behind assert, which can be lost when running python in optimized mode (-O). Change-Id: I2179970df495e1215d691915c51cebe5cb4541a7
1 parent e8b56a3 commit ca90985

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

openstackclient/image/v2/image.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,9 +1024,7 @@ def take_action(self, parsed_args):
10241024

10251025
if parsed_args.properties:
10261026
for k in parsed_args.properties:
1027-
try:
1028-
assert(k in image.keys())
1029-
except AssertionError:
1027+
if k not in image:
10301028
LOG.error(_("property unset failed, '%s' is a "
10311029
"nonexistent property "), k)
10321030
propret += 1

0 commit comments

Comments
 (0)