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

Side by Side Diff: kick.py

Issue 6572117575335936: Issue 2200 - PART II/II - Introduce --local and --remote parameters in {run,kick}.py (Closed)
Patch Set: Created April 8, 2015, 12:31 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | run.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 getopt 5 import getopt
6 from run import resolveHostList, runCommand, createArgumentParser 6 from run import resolveHostList, runCommand, createArgumentParser
7 7
8 def parseOptions(args): 8 def parseOptions(args):
9 description = 'Run provisioning on the given hosts or groups of hosts' 9 description = 'Run provisioning on the given hosts or groups of hosts'
10 parser = createArgumentParser(description=description) 10 parser = createArgumentParser(description=description)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 def updateClient(user, host, mode): 49 def updateClient(user, host, mode):
50 print 'Provisioning %s...' % host 50 print 'Provisioning %s...' % host
51 remoteCommand = 'sudo puppet agent%s' % mode 51 remoteCommand = 'sudo puppet agent%s' % mode
52 52
53 # Have to ignore errors here, Puppet will return non-zero for successful runs 53 # Have to ignore errors here, Puppet will return non-zero for successful runs
54 runCommand(user, host, remoteCommand, ignore_errors=True) 54 runCommand(user, host, remoteCommand, ignore_errors=True)
55 55
56 if __name__ == '__main__': 56 if __name__ == '__main__':
57 options = parseOptions(sys.argv[1:]) 57 options = parseOptions(sys.argv[1:])
58 needKicking = resolveHostList(options.hosts) 58 needKicking = resolveHostList(options)
59 if len(needKicking) == 0: 59 if len(needKicking) == 0:
60 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do' 60 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do'
61 sys.exit(0) 61 sys.exit(0)
62 updateMaster(options.user) 62 updateMaster(options.user)
63 for host in needKicking: 63 for host in needKicking:
64 updateClient(options.user, host, options.mode) 64 updateClient(options.user, host, options.mode)
OLDNEW
« no previous file with comments | « no previous file | run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld