| OLD | NEW | 
|---|
| 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  Loading... | 
| 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) | 
| OLD | NEW | 
|---|