systematic use of context managers for dealing with files instead of open()/close...
[nepi.git] / src / nepi / resources / planetlab / node.py
index fe7f058..9ef4a19 100644 (file)
@@ -210,10 +210,12 @@ class PlanetlabNode(LinuxNode):
         plblacklist_file = os.path.join(nepi_home, "plblacklist.txt")
         if not os.path.exists(plblacklist_file):
             if os.path.isdir(nepi_home):
-                open(plblacklist_file, 'w').close()
+                with open(plblacklist_file, 'w') as clear:
+                    pass
             else:
                 os.makedirs(nepi_home)
-                open(plblacklist_file, 'w').close()
+                with open(plblacklist_file, 'w') as clear:
+                    pass
 
     def _skip_provision(self):
         pl_user = self.get("pluser")