From ca90985f4e5e4ebcf97afd6cce38932e73120255 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Mon, 22 Jan 2018 12:24:01 +0200 Subject: [PATCH] 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 --- openstackclient/image/v2/image.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index d793c4599b..0b8647a0ca 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -1024,9 +1024,7 @@ class UnsetImage(command.Command): if parsed_args.properties: for k in parsed_args.properties: - try: - assert(k in image.keys()) - except AssertionError: + if k not in image: LOG.error(_("property unset failed, '%s' is a " "nonexistent property "), k) propret += 1