bot-status.py: Use shutil.move instead of os.rename
os.rename fails if the source and destination are on
different file systems.
For instance my machine has /tmp and /work/<this repo>
on different file systems.
https://docs.python.org/3/library/os.html#os.rename
shutil.move handles this for you.
https: //docs.python.org/3/library/shutil.html#shutil.move
Change-Id: I6cd6442413bb4a3ed5c6007a18fef327bfbc71c7
diff --git a/monitor/bot-status.py b/monitor/bot-status.py
index 40630e5..cf136f6 100755
--- a/monitor/bot-status.py
+++ b/monitor/bot-status.py
@@ -14,6 +14,7 @@
import json
import tempfile
import logging
+import shutil
from datetime import datetime, timedelta
# The requests allows HTTP keep-alive which re-uses the same TCP connection
# to download multiple files.
@@ -198,7 +199,7 @@
# Move temp to main (atomic change)
temp.close()
- os.rename(temp.name, sys.argv[2])
+ shutil.move(temp.name, sys.argv[2])
if __name__ == "__main__":