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

Side by Side Diff: kick.py

Issue 6676867801153536: Issue 2379 - Ensure Puppet-master update taking place before resolving hosts (Closed)
Patch Set: Created April 21, 2015, 1:50 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 | no next file » | 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 updateMaster(options.user)
58 needKicking = resolveHostList(options) 59 needKicking = resolveHostList(options)
59 if len(needKicking) == 0: 60 if len(needKicking) == 0:
60 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do' 61 print >>sys.stderr, 'No valid hosts or groups specified, nothing to do'
61 sys.exit(0) 62 sys.exit(0)
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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld