Ori.livneh has submitted this change and it was merged.

Change subject: scap: ensure tmpfile is flushed; pass env to dsh
......................................................................


scap: ensure tmpfile is flushed; pass env to dsh

Change-Id: I7334667160b96f4adace08263ffc306d8dad6137
---
M bin/scappy
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Ori.livneh: Verified; Looks good to me, approved



diff --git a/bin/scappy b/bin/scappy
index 6960212..f4135e2 100755
--- a/bin/scappy
+++ b/bin/scappy
@@ -13,6 +13,7 @@
 import os
 import pipes
 import random
+import re
 import socket
 import struct
 import subprocess
@@ -112,7 +113,7 @@
     group_file = os.path.join('/etc/dsh/group', group)
     return subprocess.call(['/usr/bin/dsh', '-F40', '-cM', '-f',
                             group_file, '-o', '-oSetupTimeout=10', '--',
-                            command.strip()])
+                            command.strip()], env=os.environ)
 
 
 def check_syntax(*paths):
@@ -169,15 +170,17 @@
 
         with open('/etc/dsh/group/scap-proxies') as f:
             rsync_servers = ' '.join(
-                ln.strip() for ln in f if not ln.startswith('#'))
+                re.findall(r'^\w+', f.read(), re.MULTILINE))
 
         with open('/etc/dsh/group/mediawiki-installation', 'rt') as f:
             # Randomize the order of target machines
-            hosts = [ln for ln in f if not ln.startswith('#')]
+            hosts = re.findall(r'^\w+', f.read(), re.MULTILINE)
             random.shuffle(hosts)
             with tempfile.NamedTemporaryFile(delete=False) as tmp:
                 try:
-                    tmp.write(''.join(hosts))
+                    tmp.write('\n'.join(hosts))
+                    tmp.flush()
+                    tmp.close()
                     log.debug('copying code to apaches')
                     dsh('/usr/local/bin/scap-1 "%s"' % rsync_servers,
                         tmp.name, env)

-- 
To view, visit https://gerrit.wikimedia.org/r/111424
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7334667160b96f4adace08263ffc306d8dad6137
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to