correct a mistake for os.getenv() 59/31159/1
authorwu.zhihui <wu.zhihui1@zte.com.cn>
Wed, 15 Mar 2017 05:00:25 +0000 (13:00 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Tue, 21 Mar 2017 09:10:16 +0000 (09:10 +0000)
os.getenv returns a string not a boolean.
Although you set environment variable 'CI_DEBUG=false',
the cleanup will not be executed.

Change-Id: I077b602069f026a4b9ef6019869ac6c29c401c21
Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
(cherry picked from commit b07a423d0fb1b6bfbdb851195097d6fda38bc20e)

qtip/util/env.py

index e666894..9299f8c 100644 (file)
@@ -193,7 +193,7 @@ class AnsibleEnvSetup(object):
     def cleanup(self):
         CI_DEBUG = os.getenv('CI_DEBUG')
 
-        if CI_DEBUG:
+        if CI_DEBUG is not None and CI_DEBUG.lower() == 'true':
             logger.info("DEBUG Mode: please do cleanup by manual.")
         else:
             with open(self.keypair['public'], 'r') as f: