X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FGetBootMedium.py;fp=PLC%2FMethods%2FGetBootMedium.py;h=7225b126c1ca38100b1f9ff64acce80315d65712;hb=41b097a10c1ac6dcd493b030d33194003369bdf1;hp=824840974d92568980dbdc088ce3d65b464532f4;hpb=b3a391490764be17194820147b1cf47fff17b69a;p=plcapi.git diff --git a/PLC/Methods/GetBootMedium.py b/PLC/Methods/GetBootMedium.py index 8248409..7225b12 100644 --- a/PLC/Methods/GetBootMedium.py +++ b/PLC/Methods/GetBootMedium.py @@ -312,8 +312,16 @@ class GetBootMedium(Method): raise PLCInvalidArgument, "File %s not under %s"%(filename,self.WORKDIR) ### output should not exist (concurrent runs ..) + # numerous reports of issues with this policy + # looks like people sometime suspend/cancel their download + # and this leads to the old file sitting in there forever + # so, if the file is older than 5 minutes, we just trash + grace=5 + if os.path.exists(filename) and (time.time()-os.path.getmtime(filename)) >= (grace*60): + os.unlink(filename) if os.path.exists(filename): - raise PLCInvalidArgument, "Resulting file %s already exists"%filename + raise PLCInvalidArgument, "Resulting file %s already exists - please try again in %d minutes"%\ + (filename,grace) ### we can now safely create the file, ### either we are admin or under a controlled location