Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/111377
Change subject: ensure tmpfile is accessible to dsh subprocess
......................................................................
ensure tmpfile is accessible to dsh subprocess
Specify delete=False in invocation of NamedTemporaryFile constructor to ensure
that the temporary file it creates exists on disk and is accessible to other
processes. Wrap the dsh invocations that depend on it in a try / finally. In
the finally block, ensure that the file is cleaned up.
Change-Id: Ie18a7cb2eaeee2cb9ec95c039d2bb52487ab62a7
---
M bin/scappy
1 file changed, 10 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap
refs/changes/77/111377/1
diff --git a/bin/scappy b/bin/scappy
index 55de8fd..02c3395 100755
--- a/bin/scappy
+++ b/bin/scappy
@@ -157,14 +157,16 @@
# Randomize the order of target machines
hosts = [ln for ln in f if not ln.startswith('#')]
random.shuffle(hosts)
- with tempfile.NamedTemporaryFile(prefix='scap') as tmp:
- tmp.write(''.join(hosts))
- log.debug('copying code to apaches')
- dsh('/usr/local/bin/scap-1 "%s"' % rsync_servers,
- tmp.name, env)
-
- log.debug('rebuilding CDB files from /upstream')
- dsh('/usr/local/bin/scap-rebuild-cdbs', tmp.name, env)
+ with tempfile.NamedTemporaryFile(delete=False) as tmp:
+ try:
+ tmp.write(''.join(hosts))
+ log.debug('copying code to apaches')
+ dsh('/usr/local/bin/scap-1 "%s"' % rsync_servers,
+ tmp.name, env)
+ log.debug('rebuilding CDB files from /upstream')
+ dsh('/usr/local/bin/scap-rebuild-cdbs', tmp.name, env)
+ finally:
+ os.remove(tmp.name)
# Builds wikiversions.cdb and syncs it to the apaches with the dat
# file. This is done after all else so that deploying new MW versions
--
To view, visit https://gerrit.wikimedia.org/r/111377
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie18a7cb2eaeee2cb9ec95c039d2bb52487ab62a7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits