Fix filemode for temporary files in yum spider
authorMagnus Hagander <magnus@hagander.net>
Wed, 15 May 2019 09:39:25 +0000 (11:39 +0200)
committerMagnus Hagander <magnus@hagander.net>
Thu, 16 May 2019 15:13:13 +0000 (17:13 +0200)
This was broken in the python3 update, but it's only used when testing
via temporary files and never in production, and thus went unnoticed.

tools/ftp/spider_yum.py

index 502eb4b14fb25f74d0c648d177d0b05b5692c675..f2b61364e9a3e127b78375e54a9ca6b776400c06 100755 (executable)
@@ -112,7 +112,7 @@ if __name__ == "__main__":
             print("Failed to upload: %s" % x)
             sys.exit(1)
     else:
-        with NamedTemporaryFile(dir=os.path.dirname(os.path.abspath(args.target))) as f:
+        with NamedTemporaryFile(mode='w', dir=os.path.dirname(os.path.abspath(args.target))) as f:
             f.write(j)
             f.flush()
             if os.path.isfile(args.target):