TPE-303 Fixed ref-purge-project-obs Fail 33/147533/1
authorYonghee Han <onstudy@samsung.com>
Tue, 5 Sep 2017 00:33:07 +0000 (09:33 +0900)
committerYonghee Han <onstudy@samsung.com>
Tue, 5 Sep 2017 00:33:07 +0000 (09:33 +0900)
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

index 43b35c1..0698ac9 100644 (file)
@@ -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__':