Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: kick.py

Issue 5611225295618048: Issue 1267 - Provide a way to run some command on multiple hosts (Closed)
Left Patch Set: Created Aug. 25, 2014, 2:43 p.m.
Right Patch Set: Print all logging output to stderr Created Aug. 29, 2014, 10:08 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « .hgignore ('k') | run.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 import sys 4 import sys
5 import os
6 import re
7 import subprocess
8 import getopt 5 import getopt
9 import yaml
10 from run import resolveHostList, runCommand 6 from run import resolveHostList, runCommand
11 7
12 def usage(): 8 def usage():
13 print >>sys.stderr, ''' 9 print >>sys.stderr, '''
14 Usage: %s [-u <user>] [-t|-q] [<host>|<group>] ... 10 Usage: %s [-u <user>] [-t|-q] [<host>|<group>] ...
15 11
16 Runs provisioning on the given hosts or groups of hosts. 12 Runs provisioning on the given hosts or groups of hosts.
17 13
18 Options: 14 Options:
19 -u <user> User name to use with the SSH command (needs access to puppet 15 -u <user> User name to use with the SSH command (needs access to puppet
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 61
66 if __name__ == "__main__": 62 if __name__ == "__main__":
67 user, mode, args = parseOptions(sys.argv[1:]) 63 user, mode, args = parseOptions(sys.argv[1:])
68 needKicking = resolveHostList(args) 64 needKicking = resolveHostList(args)
69 if len(needKicking) == 0: 65 if len(needKicking) == 0:
70 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do' 66 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do'
71 sys.exit(0) 67 sys.exit(0)
72 updateMaster(user) 68 updateMaster(user)
73 for host in needKicking: 69 for host in needKicking:
74 updateClient(user, host, mode) 70 updateClient(user, host, mode)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld