From 28a93b3cef929da4bfbd14d224aecf31d0f18dfd Mon Sep 17 00:00:00 2001 From: Yonghee Han Date: Tue, 5 Sep 2017 09:33:07 +0900 Subject: [PATCH] TPE-303 Fixed ref-purge-project-obs Fail Add a exception code about Forbidden error for the cleanup execution. Remove a code for Purge SMR project. Change-Id: I39fcbf27cb14f132202403c37f3f815188f7236b --- job_ref_purge_prj_obs.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/job_ref_purge_prj_obs.py b/job_ref_purge_prj_obs.py index 43b35c1..0698ac9 100644 --- a/job_ref_purge_prj_obs.py +++ b/job_ref_purge_prj_obs.py @@ -95,27 +95,14 @@ def main(): cleanup = False break if cleanup: - build.cleanup(prj, "This project has expired") - print "%s project is remove." % prj + try: + build.cleanup(prj, "This project has expired") + print "%s project is remove." % prj + except Exception as err: + print "%s project is remove error = %s" % (prj, err) else: print "%s project is reference project. Skip remove project !!!!" % prj - #### Purge SMR Project #### - smr_prj_list = [ obj for obj in build.get_package_list("") \ - if not obj.find("Tizen:") == -1 \ - and not obj.find(":smr:") == -1 \ - and obj.find(":Base:") == -1 ] - - if os.getenv("SMR_PURGE_PRJ_HOUR"): - remove_hour = os.getenv("SMR_PURGE_PRJ_HOUR") - for prj in smr_prj_list: - create_datetime = datetime.strptime(prj.split(':')[-1], "%Y%m%d.%H") - #print create_datetime - post_hour = divmod((now_datetime - create_datetime).total_seconds(), 3600)[0] - if int(post_hour) > int(remove_hour): - build.cleanup(prj, "This project has expired") - print "%s project is remove." % prj - return if __name__ == '__main__': -- 2.7.4